Cache Poisoning at Scale
The author found that several caching proxies and CDNs generated cache keys that ignored parts of the request (URL fragments, certain headers, extra query parameters), so a single crafted request could store a poisoned response under a shared key. This let an attacker take down static files and pages for all unauthenticated users, and in one case redirect JavaScript files to attacker-controlled code, giving stored XSS across many subdomains.
youst.in
Published on youst.in
Identifying and exploiting over 70 cache poisoning vulnerabilities across major bug bounty programs, including GitHub, GitLab, Shopify and HackerOne.
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 caches built their cache keys from a normalised subset of the request (host, path, query, or selected headers) while still forwarding the full original request to the backend, so the key and the backend's view of the request disagreed.
Impact
Attackers could cause denial of service against static files and pages for unauthenticated users, and in one case achieve stored XSS on a main site and over 21 subdomains; some exploits were limited by cache configuration (for example only static files being cached) or by cookies being part of the cache key.
What the attacker needed
No authentication needed; attacker can send crafted requests; target sits behind a caching proxy or CDN
The fix
The affected CDNs and proxies changed their behaviour, for example Cloudflare stopped caching 403 responses by default and Fastly and Cloudflare fixed the capitalised host header handling, while individual programs fixed their own configurations.
How it was found
- Send a request whose cache key matches a legitimate resource but whose forwarded form differs, for example by adding a URL fragment or an unkeyed header.
- Observe that the cache stores the resulting error or redirect under the shared key.
- Request the same resource as a normal user and receive the poisoned response.
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 sits in front of a website and stores copies of responses so it can serve them faster. If the cache decides which stored copy to reuse using only part of the request, an attacker can send a request that looks the same to the cache but different to the server, and the bad response gets saved and shown to everyone. This is called cache poisoning.
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.