๐ What Is It?
Software or Data Integrity Failures occur when code, infrastructure, or data is trusted without verifying it has not been tampered with. Modern apps are assembled through long automated pipelines โ package managers, CI/CD, CDNs, registries, auto-updaters โ each an opportunity to inject or alter code. Integrity is solved in theory (a hash detects modification; a signature proves authorship); the failures are almost never bad math โ they are a failure to actually perform the check. The category also absorbed Insecure Deserialization, because deserializing untrusted data is another way of trusting data whose integrity was never checked.
โ ๏ธ Top Attack Vectors
- Dependency substitution: typosquatting and dependency confusion pull attacker packages into the build (malicious
postinstallhooks). - Compromised maintainer / floating ranges: a poisoned minor version auto-upgrades via
^2.0.0. - Unverified CDN script (missing SRI): a compromised CDN runs skimmer code in every visitor's session.
- Insecure auto-update: unsigned binary installed from an attacker-influenceable channel, often at high privilege.
- Build-pipeline injection (SolarWinds-class): code inserted before signing ships malware under a genuine signature.
- Insecure deserialization โ RCE: native deserializers run gadget chains on attacker bytes; tampered cookies/tokens trusted server-side.
๐ด Attack Flow
โ
2. Position the payload (publish pkg, sit on update channel, craft gadget)
โ
3. Victim installs / builds / updates / deserializes it
โ
4. No signature or hash is checked against a trusted reference
โ
5. EXECUTE: RCE, backdoor, or rewritten authorization decision
โ Vulnerable Code
โ Secure Code
โ Prevention Checklist
- Commit lockfiles; install frozen & hash-verified (
npm ci,pip --require-hashes) - Scope internal package names to a private registry (blocks confusion)
- Add SRI hashes to all CDN scripts/styles; enforce with CSP
- CI/CD: least-privilege & short-lived (OIDC) creds; isolate the signing step
- Pin actions/plugins to immutable commit SHAs, not mutable tags
- Protected branches, mandatory review, segregation of duties
- Verify a pinned-key signature + hash before installing any update; block rollback
- Never deserialize untrusted data natively; use data-only formats + schema; HMAC client state
๐ Detection & Tools
Detection Signals:
- Lockfile hash mismatches; unexpected new transitive packages; install-time network calls
- Pipeline definition changes; unexplained use of signing secrets; update requests over plain HTTP
- Deserialization of request bodies/cookies; tokens with
alg=none