Package managers have an integrity problem
A recent study investigated the integrity of 25 popular package managers to determine if they detect compromised package repositories that inject malicious code into legitimate packages. The study found that fewer than half of the package managers used lockfiles that checked for tampering by default, and only two verified the integrity of every package they downloaded. Package managers that fail to implement these security measures are at risk of supply-chain attacks caused by developer compromise.
The study suggests including a cryptographic hash of a package's contents in a lockfile and comparing hashes after downloading the package as a natural solution to the problem. However, many package managers require extra configuration to include or verify these hashes, use hashes in a cryptographically insecure way, or lack hashes entirely.
Another approach is to use signatures, but few package managers verify signatures by default. The study found that only Go verified signatures by default, while others required extra configuration or lacked verification code.
Despite the challenges, the study also highlights several communities on the forefront of improving integrity solutions. The cryptographic answer to this problem is more subtle than it appears and requires careful consideration of design choices, resource prioritization, and developer-friendly solutions. The study emphasizes that while developers of popular packages are still the easiest targets, attackers will likely shift their focus to package repositories that serve the code.
Rewritten by urgent.news; may contain errors — check the original.
Source: blog.trailofbits.com