Trail of Bits: only 2 of 25 package managers verify every package
In short
- What was tested: Keegan Ryan of Trail of Bits, a security firm, tested 25 popular package managers (the tools developers use to download the code libraries their software depends on) to see whether each notices when a compromised package repository slips malicious code into a legitimate package. Only two, Go and vcpkg, verified the integrity of every package they downloaded.
- Why it matters: if the server that hands out packages is hacked, a package manager that does not check a cryptographic fingerprint (a hash) or a signature installs the tampered code without complaint. Of the 25, fewer than half used lockfiles that checked for tampering by default, the post says.
- The catch: this is one package, one package-manager version and one platform per tool, and the post says the setup does not show that every developer is vulnerable, only that a developer following reasonable conventions can be.
Which package managers check for tampering?
The post sorts the 25 tools by how much work a developer must do to get integrity from hashes (Table 1 of the post):
Signatures fare worse. Only Go verified signatures by default. Six (Bundler, Gem, Gradle, Maven, npm, NuGet) verify if configured; nine have missing or incomplete verification (Bun, cpanminus, Pip, pnpm, Poetry, PowerShellGet, PSResourceGet, uv, Yarn); and nine have no signatures to verify (Cargo, CocoaPods, Composer, Conan, Conda, Pub, R, SwiftPM, vcpkg). The counts of six and nine are ours, from the post's Table 2.
What is a lockfile, and how does a hash catch tampering?
A hash is a short fingerprint computed from a file's contents; change the file and the fingerprint changes. A lockfile is a file kept next to a project's source code that records the exact versions of the dependencies the project needs. If the lockfile also stores each package's hash, the package manager can recompute the hash after downloading and compare. A mismatch means the file is not what the developer originally used. (This plain explanation is ours.)
That is how Bun works, the post explains: adding a package updates bun.lock, and installing from a committed lockfile on another copy verifies the hash. npm, pnpm, Yarn, uv, Poetry, Bundler, Cargo and SwiftPM behave similarly. The condition is the lockfile: without one, these tools have no trusted hash to compare against.
vcpkg, Microsoft's C and C++ package manager, gets its hashes another way: the manager's own source code carries the content hashes, added through pull requests. The post calls this fully secure against a malicious repository as long as the package manager itself is trusted, and notes that vcpkg must be updated with git pull to get new hashes, a question the test leaves out.
When a hash is present but does not protect
The post found several lockfiles that hold a hash yet still let a malicious server through. It adds that this is not necessarily a vulnerability, since the behaviour is documented.
- Pub (Dart and Flutter): on a hash mismatch it reports the error but installs the package anyway and updates the lockfile; blocking needs the non-default --enforce-lockfile option.
- pnpm: overwrote the lockfile after a mismatch by default until version 11.4 in May 2026, which changed this to close "supply-chain holes", the post says.
- Conan: its lockfile holds an MD5-based revision identifier meant as a unique ID rather than security, and Conan does not recompute it.
- CocoaPods: the SHA-1 checksum covers the Podspec, not the code; a compromised GitHub could serve a different repository under the same tag.
- Composer: the lockfile holds a commit hash, but the ZIP archive it downloads is not checked against it.
How were the tests run?
The author built a harness from Docker containers and mitmproxy, a tool that sits in the network path. Each container held a package manager, sample code and, optionally, a lockfile. A custom addon rewrote the repository's responses so the downloaded package contained malware; if the sample code ran the malware, the attack counted as successful. The post assumes any web-facing server can be compromised, but private signing keys stay safe.
Tests ran with default flags on the latest package-manager versions, following quick-start guides. Both lockfile and no-lockfile set-ups were tried. The post lists its limits: one package, one version, one platform, and some tools (PowerShell and CocoaPods) ran on Ubuntu, which may not match common use. Footnote 1 adds that system package managers such as APT, Chocolatey and Homebrew were left out.
Other findings
- HTTPS: nearly all tools use encrypted connections and validate certificates. The exception is cpanminus, for Perl, which uses unencrypted HTTP by default, so any active network attacker can inject code. The developer has not changed it because it would break default behaviour; the Perl Docker image patches it to HTTPS.
- Signatures exist but are not checked: npm does not check registry signatures on npm install; that needs npm audit signatures. NuGet's default signatureValidationMode is accept, which installs invalidly signed packages. Pip, uv and Poetry cannot verify identity-based attestations (PEP 740).
- Go: it hashes each download and compares it with a signed checksum database whose public key is hard-coded in Go. The post calls Go the best performer, but notes trust concentrates in one private key.
What does the author propose?
Put signature information in the lockfile: commit to a developer's identity or public key rather than a single package hash, so a lockfile can allow updates yet still resist a malicious repository. The post adds that a transparency log (a public, tamper-resistant record) could guard against targeted attacks, building on Sigstore's keyless signing. It says the idea is not new and cites pylock.toml, Gradle's trusted keys and a Maven plugin as steps in that direction. It compares the state of package signing to HTTPS a decade ago.
The post also cautions that lockfile hashes were not designed mainly for supply-chain security, and that pinning hashes delays security updates until the lockfile is bumped. It cites a study by Gamage et al. covering seven package managers and interviews with 15 developers.
Terms in plain English
- Package manager: a tool that downloads and installs the libraries a project depends on. (Ours.)
- Package repository: the server a package manager downloads from. (Ours.)
- Hash: a fingerprint computed from a file; any change alters it. (Ours.)
- Signature: a cryptographic stamp by a developer or a repository proving who published a package. (Ours.)
- Transparency log: a public, tamper-resistant record that makes secret, targeted tampering harder. (Ours.)
Where things stand
The post says several communities are already working on this: Cargo developers are considering signing designs, Composer developers plan artifact integrity, and Conan's developers previously decided not to add signatures. We did not check for changes after 14 October 2026.
Sources
- Package managers have an integrity problem, Trail of Bits, 14 October 2026
Sources
Related stories
- Cursor says a leaked vendor key led to a fake Claude Code extension
- Cloudflare brings full post-quantum switch forward to 2027
- Anthropic says plain Claude Code review finds 11 of 21 logic bugs
- OpenSSL fixes Encrypted Client Hello bug allowing impersonation
- Anthropic posts quantum algorithms its authors call impractical
- Self-tuning GPS receiver resists slow spoofing longer in simulation
More from Vulnerability Research
- Why urgent security patches are slow, and four ways to speed them
- OpenSSL fixes a DTLS bug that can leak heap memory to a peer
- Unzeroed disk blocks let Cloudflare Containers leak old data
- Check Point VPN certificate flaw is exploited days after its fix
- AI agents help factor 260-digit RSA-260 on GPUs, Cognition says