0Pricing
Cyber Security Academy · Lesson

Supply Chain Threats

How dependencies become attack vectors.

Supply Chain Threats is a free Cyber Security Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is a Supply Chain Attack

A software supply chain attack compromises an organization not by breaching it directly, but by corrupting something it trusts and consumes: a library, a build tool, a container base image, or an update server.

Because modern software is assembled from hundreds of third-party components, a single poisoned link is inherited by every downstream consumer. The attacker invests once and reaches many victims.

  • Trust inversion — the security boundary moves outside your own code
  • Transitive blast radius — one bad package flows to thousands of builds

The Dependency Iceberg

When you add one direct dependency, you often pull in dozens of transitive ones you never chose. A typical Node or Python app declares a handful of packages but resolves to hundreds.

List the full resolved tree, not just the manifest, to see what you actually ship:

# npm: full resolved dependency tree
npm ls --all

# Python: pinned transitive closure
pip freeze

# count transitive nodes
npm ls --all --parseable | wc -l

Typosquatting and Confusion

Attackers publish malicious packages with names that resemble popular ones, betting on a fatal typo.

  • Typosquattingreqeusts instead of requests
  • Combosquattingpython-requests mimicking the real name
  • Dependency confusion — publishing a public package with the same name as your internal private one, so a misconfigured resolver fetches the attacker version

Defend by pinning a trusted internal registry and using scoped or namespaced private packages.

Account and Maintainer Takeover

A legitimate, widely trusted package can turn hostile if its maintainer account is compromised or a malicious contributor gains publish rights.

Recent real-world incidents show attackers phishing maintainer credentials, then pushing a poisoned patch release that exfiltrates tokens during install.

  • Require 2FA on all publishing accounts
  • Prefer packages with scoped publish tokens and protected releases
  • Watch for unexpected new maintainers on critical dependencies

Malicious Install Scripts

Many ecosystems run code at install time, before your app ever runs. An npm install can execute a postinstall hook that steals environment variables or SSH keys.

Disable arbitrary install scripts in CI and audit any package that needs them:

# npm: block lifecycle scripts during install
npm ci --ignore-scripts

# inspect what a package would run
npm view <package> scripts

# pnpm equivalent
pnpm install --ignore-scripts

Compromised Build Tooling

The build environment itself is a high-value target. If an attacker poisons a compiler, CI runner image, or a build plugin, every artifact it produces is backdoored even when your source code is clean.

The classic example is a trojanized update mechanism that signs malware with a legitimate code-signing key, so victims accept it as authentic.

  • Treat build infrastructure as production with full hardening
  • Use ephemeral, reproducible build runners
  • Separate signing keys from the build host

Lockfiles and Integrity Hashes

A lockfile pins exact versions and content hashes, so a re-resolve cannot silently swap in a different artifact. Always commit it and let CI verify it rather than re-resolving freely.

The integrity field stores a hash; if the downloaded tarball does not match, the install fails.

# package-lock.json integrity entry
# "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
# "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA=="

# CI must install from lock, never re-resolve
npm ci
yarn install --frozen-lockfile

Vulnerability Scanning of Dependencies

Known-vulnerable versions (tracked as CVEs) are the most common supply chain weakness. Software Composition Analysis (SCA) tools cross-reference your resolved dependencies against vulnerability databases.

Run scans in CI and fail builds on critical findings:

# npm built-in audit
npm audit --audit-level=high

# OSV scanner across ecosystems
osv-scanner --lockfile=package-lock.json

# Trivy for filesystem and images
trivy fs --severity HIGH,CRITICAL .

Pinning and Vendoring

Floating version ranges (^1.2.0) let new releases flow in automatically, which is convenient but exposes you to a malicious patch.

  • Pin to exact versions and review upgrades deliberately
  • Pin by digest for container images, not by mutable tags like latest
  • Vendor critical dependencies into your own repo or mirror so an upstream deletion cannot break or poison you
# pin a container image by immutable digest
FROM python:3.12-slim@sha256:1d52838af602b4b5a831beb13a0e4d073280665ea7be7f69ce2382f29c5a613f

Continuous Monitoring and Provenance

Securing the supply chain is ongoing, not a one-time scan. You need to know what you ship, where it came from, and when it becomes vulnerable.

  • Generate an SBOM for every release (next lesson)
  • Capture build provenance so you can prove how an artifact was produced
  • Subscribe to advisories so a newly disclosed CVE triggers re-evaluation of already-shipped builds

Threat Modeling the Pipeline

Map every stage where untrusted input enters: developer machines, source control, dependency registries, the build system, artifact storage, and the update channel. Each is a potential injection point.

For each stage ask: who can write here, what would a compromise let them do, and how would I detect it? This produces a prioritized list of controls rather than a generic checklist.

Quick Check: Dependency Confusion

Test your understanding of a common supply chain attack class.

Recap: Supply Chain Threats

You learned why dependencies are attack vectors and how to reduce that exposure.

  • Trust inversion means your security depends on third parties you do not control
  • Key threats: typosquatting, dependency confusion, maintainer takeover, malicious install scripts, and compromised build tooling
  • Core defenses: lockfiles with integrity hashes, SCA scanning, exact pinning by digest, 2FA on publishers, and continuous monitoring

Next, you will inventory exactly what your software contains with an SBOM.

Frequently asked questions

Is the “Supply Chain Threats” lesson free?

Yes — the full text of “Supply Chain Threats” is free to read here on the web, and the Cyber Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cyber Security Academy course, upgrade to CoddyKit PRO.

What will I learn in “Supply Chain Threats”?

How dependencies become attack vectors. You practise Cyber Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cyber Security Academy?

No prior experience is required. Cyber Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Supply Chain Threats” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cyber Security Academy lesson?

Yes. Every Cyber Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Supply Chain Threats
  2. Software Bill of Materials (SBOM)
  3. Dependency and Artifact Signing
  4. Securing CI/CD Pipelines
← Back to Cyber Security Academy