Cybersecurity

Supply Chain Attacks in Software

See how attackers reach you through trusted updates, packages and vendors, and which checks reduce that risk.

Key takeaways

  • Supply chain attacks abuse trust in dependencies, build systems, update channels, extensions and service providers.
  • Common tricks include look-alike package names, stolen maintainer accounts and malicious code added to a legitimate release.
  • Pinned versions with lockfiles and hash checks make installs repeatable and stop silent changes.
  • Build systems hold powerful secrets, so give them narrow permissions and treat them like production.
  • Knowing what you depend on, and having a way to roll back, decides how fast you can respond.

A software supply chain attack reaches you through something you already trust. Instead of breaking into your systems directly, the attacker tampers with a library your developers install, an update your vendor ships, a browser extension you rely on or a service provider that has access to your network. You then bring the problem inside yourself.

The appeal is leverage. Compromising one widely used component can reach every project and customer downstream. You can't remove the risk without giving up other people's software entirely, but you can control what comes in, limit what it can do and notice when it misbehaves.

What the chain contains

A modern application is mostly assembled. Your own code sits on top of open source libraries, which depend on other libraries, which depend on more. A small web project can easily pull in hundreds of packages its authors have never looked at. These indirect ones are transitive dependencies.

Around the code is the machinery: developers' laptops, a source repository, a continuous integration server that builds and tests, a registry that stores packages or container images, and an update mechanism that delivers the result to users. Each link can be attacked.

Where a software supply chain can be tampered with
1 Developer machine Stolen credentials or malware let someone commit as a trusted person. 2 Source repository A malicious change slips past review. 3 Dependencies A poisoned or look-alike package is pulled in. 4 Build system Output is altered, or signing secrets are taken. 5 Distribution A registry or update server serves a tampered file. 6 Users The change installs through a channel they trust. Developer machine Stolen credentials or malware let someone commit as a trusted person. 1 Source repository A malicious change slips past review. 2 Dependencies A poisoned or look-alike package is pulled in. 3 Build system Output is altered, or signing secrets are taken. 4 Distribution A registry or update server serves a tampered file. 5 Users The change installs through a channel they trust. 6

Common techniques, in outline

Typosquatting publishes a package with a name close to a popular one and waits for a mistyped install command.

Dependency confusion exploits tools that search both private and public registries. A public package with the same name as an internal one may be chosen by mistake. Scoped or namespaced packages and a single controlled source prevent this.

Account takeover of a maintainer lets an attacker publish a new, malicious version of a genuine package. Reused passwords, phishing and leaked tokens are typical causes.

Malicious maintainers and handovers occur when someone gains trust over time, or a tired author passes a project to a stranger. The backdoor found in the xz compression utilities in 2024 followed a long effort to earn that kind of trust.

Compromised vendor updates put hostile code into a legitimately signed commercial product. The SolarWinds Orion incident disclosed in late 2020 is the best-known example: customers installed a tampered update from their own supplier.

Compromised service providers use the access that IT management companies, support tools or cloud integrations already hold.

Why signatures and reputation aren't enough

Digital signatures prove that a file came from the holder of a particular key and has not changed since signing. That defeats tampering in transit or on a mirror server. It says nothing about whether the content was safe when it was signed. If the build system was compromised, the attacker's code gets a perfectly valid signature.

Popularity has the same limit. Download counts and stars show that many people use something, which also makes it a better target.

The same applies to checksums. A hash confirms that you received the intended bytes, provided the expected value comes from somewhere the attacker couldn't change.

Controlling what comes in

For anyone who writes or deploys software, start with repeatability.

  • Commit lockfiles so every build uses the same versions. In Node projects, npm ci installs exactly what the lockfile lists.
  • Verify hashes. Python's pip can require them for every package.
# Node: install strictly from the lockfile
npm ci

# Python: refuse anything whose hash is not listed
pip install --require-hashes -r requirements.txt
  • Review before you add. Check the name carefully, who maintains it, how active it is and whether you need it at all.
  • Update deliberately. Automated update proposals are useful, but read what changed. A short delay before adopting brand-new releases gives others time to report trouble, with exceptions for urgent security fixes.
  • Be careful with install scripts, which run code on your machine at installation time. Many package managers let you disable them.
  • Use one trusted source, such as an internal proxy registry, so you can block a bad package in one place.

Protecting the build

A build server typically holds repository access, signing keys, cloud credentials and publishing tokens. That makes it one of the most valuable machines you have.

Give each job only the permissions it needs, and prefer short-lived credentials issued per run over permanent keys. Don't expose secrets to builds triggered by untrusted contributors. Pin third-party pipeline actions or plugins to specific, reviewed versions. Require review for changes to pipeline definitions. The basics of handling secrets are in environment variables and secrets, and the pipeline concept is in continuous integration and delivery.

Stronger setups record provenance, a signed statement of which source and which process produced an artifact. Frameworks such as SLSA and signing tools such as Sigstore support this. Reproducible builds, where independent parties get identical output from the same source, make hidden changes easier to detect.

Knowing what you have

When a bad component is announced, the first question is "are we affected, and where?" A software bill of materials (SBOM) is a machine-readable list of components and versions in a product. SPDX and CycloneDX are two common formats. You can generate one during each build and keep it with the release.

Even without formal tooling, you can ask your package manager:

npm ls --all
pip list

Ask vendors whether they provide an SBOM, how they notify customers about compromises and how quickly they ship fixes.

Limiting the damage

Assume that something you trust will eventually be wrong.

Layers that contain a bad component
Choose Fewer dependencies, from sources you have checked. Pin Exact versions and hashes, changed only on purpose. Restrict Software and vendors get the least access that works. Watch Alert on unexpected network connections and new processes. Recover Roll back, rotate secrets and rebuild from clean sources. Choose Fewer dependencies, from sources you have checked. Pin Exact versions and hashes, changed only on purpose. Restrict Software and vendors get the least access that works. Watch Alert on unexpected network connections and new processes. Recover Roll back, rotate secrets and rebuild from clean sources.

Restricting outbound network access from servers is especially useful: much malicious code has to contact its operator. So is reviewing the access granted to third-party integrations, and removing the ones nobody uses.

When a component is reported malicious

  1. Identify every place the bad version was installed, including developer laptops and build runners.
  2. Stop builds and deployments that would pull it again, and pin or block the version.
  3. Assume any secret available to the machines that ran it is exposed. Rotate tokens, keys and passwords.
  4. Check logs for connections to addresses named in the advisory.
  5. Rebuild from a known-good state and document what happened.

Simply upgrading is not enough if the code already ran with access to your credentials.

Questions to ask before adding a dependency

A short review catches many problems before they enter a project.

  • Do you need it? A few lines of your own code can be safer than a package with its own tree of dependencies.
  • Is the name exactly right? Copy it from the project's official documentation, not from memory or a forum reply. Code suggested by an AI assistant can name packages that don't exist, which someone else could later register.
  • Who can publish it? Several active maintainers and strong account protection are better signs than one dormant account.
  • Does the published package match the repository? The file you install may contain things the source view doesn't show.
  • What runs at install time? Unexpected scripts, obfuscated code or network calls deserve a closer look.
  • What changed recently? A new owner, a sudden release after long silence or a large unexplained addition are reasons to wait.
  • How would you remove it? Dependencies woven through your code are hard to replace in a hurry.

Scanners that compare your dependency list with advisory databases are worth running automatically. They catch known problems, such as npm audit does for Node projects, but they cannot flag a malicious change nobody has reported yet. Treat a clean result as one input.

Vendor software deserves a parallel set of questions: how updates are signed and delivered, whether remote support access is always on or enabled on request, which of your data the vendor holds, and how quickly it has committed to telling you about a compromise.

Finally, revisit old decisions. A dependency that was well maintained when you added it may be abandoned today. A periodic pass that removes unused packages, replaces unmaintained ones and trims stale integration tokens shrinks the number of places a future attack can come from, and it usually makes builds faster and upgrades less painful too.

What it means if you don't write code

You are downstream too. Keep updates on, because delaying them leaves known holes open and the benefit of patching generally outweighs the rare tampered release. Install few browser extensions, since ownership can change and updates arrive silently. Download from official stores and publishers. If a vendor announces a compromise, follow its instructions, change relevant passwords and watch your accounts.

Small organizations should list which outside companies can log in to their systems, require multi-factor authentication on that access and ask in advance how an incident at the provider would be communicated.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Cybersecurity →

Latest news on this topic