Practical Web Cache Poisoning
The paper demonstrates that web caches can be poisoned by sending requests with unkeyed HTTP headers that influence the response, causing the harmful response to be cached and served to other users. An attacker could thereby deliver exploits such as cross-site scripting to anyone visiting the affected page.
Published on portswigger.net
Web cache poisoning has long been an elusive vulnerability, a 'theoretical' threat used mostly to scare developers into obediently patching issues that nobody could actually exploit.
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 cache key does not include all request inputs that affect the response, so an attacker-controlled header can alter the cached response served to other users.
Impact
An attacker could poison a cache so that other visitors receive a malicious response, potentially leading to script execution in their browsers, though some exploits were limited by mixed-content protections or required specific browsers.
What the attacker needed
Ability to send HTTP requests with custom headers; a cache that stores responses; an unkeyed input that affects the response
The fix
Caches should include all inputs that affect the response in the cache key, for example by keying on headers that the application uses, and applications should avoid using unkeyed headers to generate URLs or content.
How it was found
- Identify unkeyed inputs, for example by using Param Miner to guess header names and observe their effect on the response.
- Assess how much damage the unkeyed input can cause, such as injecting a script.
- Try to get the harmful response stored in the cache, using a cache-buster to avoid affecting other visitors.
- If caching fails, study how the cache works and find a cacheable target page before retrying.
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 web cache is a server that stores copies of web pages so they load faster for everyone. If a website builds a page using information from a request header that the cache does not consider when deciding which stored copy to serve, an attacker can make the cache store a malicious version. That malicious copy is then shown to other visitors.
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.