Cache Clash: How CDN Misconfigurations Let Me Hijack Thousands of User Sessions
The CDN cached dynamic API responses using only the URL path as the cache key, ignoring headers like Authorization and Cookie. An attacker could poison the cache with malicious JavaScript via the X-Forwarded-Host header and retrieve other users' cached private data, leading to session hijacking and data leakage.
Free link 🎈
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 CDN was configured to use only the URL path as the cache key, ignoring headers such as Authorization and Cookie, and the application trusted the X-Forwarded-Host header without validation.
Impact
The attacker could hijack user sessions, leak private data across all users, and distribute malware via cache poisoning, though the text does not mention any defences that limited the attack.
What the attacker needed
Access to the CDN endpoint; Ability to send custom headers
The fix
The CDN should include all relevant headers (Authorization, Cookies) in cache key generation, never cache dynamic content, and validate X-Forwarded-* headers.
How it was found
- Identify cacheable dynamic endpoints through the CDN.
- Test cache behaviour with different Authorization headers and observe X-Cache: HIT for different users.
- Test the X-Forwarded-Host header and observe X-Cache: MISS and that the response body includes a script tag pointing to the attacker's host.
- Poison the cache by sending a request with a malicious X-Forwarded-Host header and a script payload.
- Request the same URL without authentication to retrieve cached private data from other users.
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 CDN (Content Delivery Network) is a service that stores copies of website content to serve it faster. Here, the CDN mistakenly stored private user data and served it to anyone who asked for the same web address, because it didn't check who was asking. This let an attacker see other people's account details and even inject malicious code that would run in victims' browsers.
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.