How an Unsanitized Header Generated a $6,000 Bounty via Cache Poi
The application generated static JavaScript resource URLs using the unvalidated X-Forwarded-Host header, and the caching layer did not include this header in the cache key. An attacker could poison the cache so that legitimate users loading the login page would fetch JavaScript from an attacker-controlled domain.
When auditing web applications, developers often assume that caching layers are purely transparent infrastructure — mechanisms designed to speed up response times without altering how data is processed. However, when a reverse proxy caches a response that relies on unvalidated client-supplied headers, a minor…
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
The application used the client-supplied X-Forwarded-Host header to build static resource URLs, and the caching layer did not include this header in the cache key, allowing cache poisoning.
Impact
Any user visiting the login page during the cache window would load JavaScript from an attacker-controlled domain, potentially leading to script execution in their browser.
What the attacker needed
Ability to send requests with custom headers; cache stores responses for 3600 seconds
The fix
The origin was configured to build static resource URLs from hardcoded settings instead of request headers, and the reverse proxy was updated to strip untrusted X-Forwarded-* headers at the edge.
How it was found
- Send a request to /login with a custom X-Forwarded-Host header pointing to an attacker-controlled domain.
- Observe that the response contains script tags with src pointing to the attacker domain.
- Repeat the request without the custom header and observe X-Cache: HIT, indicating the poisoned response is served from cache.
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 like a storage box that keeps copies of web pages to serve them faster. The server was building links to JavaScript files using a header that visitors can set, but the cache didn't consider that header when deciding which stored page to show. So an attacker could trick the cache into storing a page with links to their own malicious JavaScript, and then everyone who visited that page would load the attacker's script.
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.