Researchers Uncover NPM Registry Vulnerability to Cache Poisoning and DoS
The npm Registry was vulnerable to cache poisoning combined with a denial-of-service attack. An attacker could send specially crafted headers to make the registry cache a 'Not Found' response for a targeted package, causing the package to be unavailable.
socket.dev
Published on socket.dev
Researchers recently demonstrated that the npm Registry is vulnerable to cache poisoning combined with DoS, posing significant risks for package availability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the backend systems mishandled certain HTTP headers, causing an error that the caching layer stored as a 'Not Found' response for the package.
Impact
An attacker could make a targeted npm package unavailable, potentially causing builds to fail and disrupting dependent projects; the attack required a volumetric effort and was considered an abuse issue by GitHub.
What the attacker needed
Ability to send HTTP requests; knowledge of target package; continuous requests to maintain poisoning
How it was found
- Identify a target package on the npm Registry.
- Send a request with a set of headers that trigger an error in the backend.
- The caching system stores a 'Not Found' response for the package.
- Repeat the request every couple of minutes to maintain the poisoning across servers.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A cache is a temporary storage that keeps copies of web content to serve it faster. Cache poisoning means tricking that storage into keeping a wrong or harmful response. Here, attackers made the npm Registry remember that a package does not exist, so people trying to download it would fail.
What is Cache bugs?
A cache and the origin disagree about a request, so a poisoned response is served to everyone or a private page is stored as public.