What is a supply chain attack and why are open-source packages a target?
A software supply chain attack compromises something you depend on, such as a library, build tool or update server, so that malicious code reaches you through a trusted channel.
Common forms
- Malicious packages published to registries like npm or PyPI, often with names similar to popular ones (typosquatting)
- Account takeover of a maintainer, allowing attackers to publish a poisoned update
- Dependency confusion: tricking build tools into pulling a public package instead of an internal one with the same name
- Compromised build systems or CI pipelines that inject code during release
- Long-term social engineering of maintainers to gain commit rights
Why it works Modern apps pull in hundreds or thousands of transitive dependencies. Few teams review all of that code, and package installs can run scripts automatically.
Defenses
- Lock dependency versions with lockfiles and review changes to them
- Use tooling that flags known vulnerabilities and suspicious packages
- Limit or audit install scripts where your package manager allows
- Prefer well-maintained packages with active communities
- Generate a software bill of materials (SBOM)
- Use signed artifacts and provenance attestations where available
- Protect publishing accounts with strong 2FA
How does your team vet new dependencies? Is anyone actually reviewing lockfile diffs in pull requests?
Comments · 2
Dependency risk is a business risk now. If your product pulls in hundreds of packages, someone else's security hygiene is part of your risk profile.
The incentive problem is that popular packages are often maintained by a few unpaid people, which makes them attractive targets and under-resourced. Who pays for that security is the open question.