courses

Software Supply-Chain Security

You don’t write most of your code

A modern application is mostly other people’s code. Run npm install on a small web app and you pull in hundreds of packages, written by people you have never met, who in turn depend on packages written by people they have never met. Your own source might be 5% of what ships; the other 95% is the software supply chain — dependencies, build tools, base images, CI/CD systems, and the channels that deliver updates to your users.

This makes supply-chain security a natural companion to memory corruption in Week 8: both are about trusting code you did not write and cannot fully see. With memory corruption the danger is a bug in trusted code; here the danger is that a component you imported is malicious, or was tampered with somewhere between its author and you. And because that component runs with your application’s full privileges, one poisoned dependency can be game over — no exploit required.

The supply chain is attractive to attackers for one reason: leverage. Compromise one popular library or one build server and you compromise everyone downstream at once — thousands of organizations from a single intrusion.

Where the attacks happen

The “chain” has many links, and an attacker only needs one:

  author ─▶ source repo ─▶ build system ─▶ artifact registry ─▶ distribution ─▶ YOU
            (account        (CI/CD          (npm, PyPI,         (CDN, package
             takeover,       injection,      Docker Hub,         mirror,
             malicious PR)   SolarWinds)     dependency          update channel)
                                             confusion)

Attacks on dependencies

Attacks on the build and distribution

Case study: the XZ Utils backdoor (CVE-2024-3094)

In March 2024 the security world narrowly avoided catastrophe. XZ Utils — a compression library bundled with virtually every Linux distribution — was found to contain a sophisticated backdoor targeting OpenSSH’s sshd, which would have granted remote code execution on hundreds of millions of systems. What makes it the defining supply-chain case study:

The lesson is sobering: signatures, code review, and version pinning would not have caught this, because the trusted maintainer signed it and the git source looked clean. It is the strongest argument for provenance, reproducible builds, and reducing dependency on under-resourced single maintainers.

Defending the supply chain

There is no single fix; the defenses stack into layers around two questions: what is in my software? and can I prove where it came from?

Know your ingredients: the SBOM

A Software Bill of Materials (SBOM) is a complete, machine-readable inventory of every component in a piece of software — like an ingredients label. When the next Log4Shell-style vulnerability drops, an SBOM answers “are we affected?” in seconds instead of weeks. Two standard formats dominate:

Manage dependencies deliberately

Prove provenance: signing and attestation

Governing frameworks

US Executive Order 14028 (2021) pushed SBOMs and supply-chain security into federal procurement, and NIST’s Secure Software Development Framework (SSDF, SP 800-218) codifies the practices. These are why SBOMs went from niche to contractual in a few years.

Worked example: inventory, scan, sign, verify

A typical modern pipeline generates an SBOM, scans it, then signs the artifact so downstream consumers can verify it. Using Anchore’s syft/grype and Sigstore’s cosign:

# 1. Generate an SBOM for a container image (SPDX format)
$ syft myapp:1.4.2 -o spdx-json > myapp.sbom.json
 ✔ Cataloged 214 packages

# 2. Scan that software for known vulnerabilities (SCA)
$ grype myapp:1.4.2
NAME        INSTALLED   FIXED-IN   VULNERABILITY    SEVERITY
libssl3     3.0.11      3.0.13     CVE-2024-XXXX    High
log4j-core  2.14.1      2.17.1     CVE-2021-44228   Critical    ← Log4Shell

# 3. Sign the image (keyless: authenticates via your OIDC identity,
#    records the signature in the public Rekor transparency log)
$ cosign sign myapp:1.4.2

# 4. A downstream consumer verifies it really came from you
$ cosign verify --certificate-identity ci@example.com \
    --certificate-oidc-issuer https://accounts.google.com myapp:1.4.2
Verified OK   ← signature valid and logged in Rekor

The SBOM tells you what is inside, grype tells you what’s vulnerable, and cosign lets anyone downstream prove the artifact is genuinely yours and unmodified — exactly the gap that bit SolarWinds’ customers.

Key takeaways

References


Related course pages: Application Security · Memory Corruption · Social Engineering · Cryptography · DevSecOps Fundamentals · Vulnerability Management

🛠️ Maintenance note: SLSA reached v1.0 in 2023 but its track/level structure is still evolving; SBOM mandates and EO/SSDF guidance change with each administration. Re-verify syft/grype/cosign command syntax against the course VM each term — Sigstore’s keyless flags in particular have changed across releases.