Software Supply Chain Attacks
Malicious packages and how to trust what you build
Modern apps are mostly other people's code. Attackers target that supply chain: publishing look-alike packages, claiming internal package names on public registries, or compromising a real maintainer. One bad dependency runs inside your build with all its secrets.
Intermediate · 5 steps
| Technique | T1195.001 (Compromise Software Dependencies) |
|---|---|
| Common tricks | Typosquatting, dependency confusion |
| Real incidents | event-stream (2018), SolarWinds (2020), xz Utils (2024) |
| Inventory | SBOM (CycloneDX, SPDX) |
| Provenance | SLSA, Sigstore signing |
| OWASP | Top 10 2025 A03: Software Supply Chain Failures |
Step by step
Typosquatting One letter off
The attacker publishes a package named like a popular one with a small typo. A developer mistypes the name once in a dependency file. The fake package works like the real one, but also runs code during installation.
Dependency confusion Internal name, public package
The company uses an internal package called
acme-authfrom its private registry. The attacker publishesacme-authon the public registry with a higher version number. A build tool that checks both registries picks the higher version: the attacker's.Code runs in the build Where the secrets are
During installation, the malicious package's script reads environment variables on the build server, which contain deploy tokens and cloud credentials, and sends them to the attacker. Nothing in the finished app looks different.
Lock down resolution Know exactly what you install
The fixes start with where packages come from. Internal names are scoped (for example
@acme/auth) and only resolved from the private registry. Lockfiles with hashes mean a build only installs the exact versions and contents that were reviewed, and new dependencies get a quick review in the pull request.Prove what you shipped SBOM, signing and provenance
Each build produces an SBOM listing every component, and the artifact is signed with a record of how and where it was built (SLSA provenance). Deploys verify the signature and provenance, and when a new vulnerable or malicious package is announced, the SBOM shows in seconds which apps include it.
How to defend
- Use lockfiles with hashes, and review new dependencies before adding them
- Scope internal package names to your private registry so public ones can't replace them
- Run builds with minimal secrets and no network access beyond what's needed
- Pin CI actions and base images by digest, not by moving tags
- Generate an SBOM and verify signatures and provenance of what you deploy
More in DevSecOps.
Packets
| No. | Time | Source | Destination | Protocol | Info | Size |
|---|