Trail of Bits: only 2 of 25 package managers verify every package

In short

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.

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

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

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

Sources

Related stories

More from Vulnerability Research

All stories from Vulnerability Research