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

TechniqueT1195.001 (Compromise Software Dependencies)
Common tricksTyposquatting, dependency confusion
Real incidentsevent-stream (2018), SolarWinds (2020), xz Utils (2024)
InventorySBOM (CycloneDX, SPDX)
ProvenanceSLSA, Sigstore signing
OWASPTop 10 2025 A03: Software Supply Chain Failures

Step by step

  1. 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.

  2. Dependency confusion Internal name, public package

    The company uses an internal package called acme-auth from its private registry. The attacker publishes acme-auth on the public registry with a higher version number. A build tool that checks both registries picks the higher version: the attacker's.

  3. 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.

  4. 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.

  5. 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

More in DevSecOps.