Recon Fatigue Is Real — Until This One URL Paid My Rent
A dynamic rendering endpoint was publicly cached and trusted the X-Forwarded-Host header, allowing an attacker to inject a script tag pointing to an external domain. The poisoned response was stored in the cache and served to other users, enabling session hijacking and sensitive data theft.
infosecwriteups.com
Published on infosecwriteups.com
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
The endpoint used the X-Forwarded-Host header to construct script URLs without validating it, and the response was cached publicly without including that header in the cache key.
Impact
The attacker could execute arbitrary JavaScript in the context of the trusted domain for any user who visited the cached URL, leading to session hijacking and theft of sensitive data such as cookies and API responses.
What the attacker needed
Ability to send HTTP requests with custom headers; target endpoint is publicly cached; endpoint uses X-Forwarded-Host to build script URLs
How it was found
- Discover the /assets/render endpoint from JavaScript files.
- Check response headers and see Cache-Control: public and X-Cache: HIT.
- Test different User-Agent headers and observe the same response, indicating User-Agent is not part of the cache key.
- Send a request with X-Forwarded-Host set to an attacker-controlled domain and observe the response contains a script tag pointing to that domain.
- Request the same URL without the malicious header and confirm the poisoned response is still served from cache.
- Verify in a clean browser session that the injected script loads from the attacker's domain.
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 stores copies of pages to serve them faster. If a page is cached without considering certain request headers, an attacker can send a malicious header that changes the page content, and that poisoned copy is then served to everyone else. Here, the server trusted a header that told it where to load scripts from, so the attacker could make the page load code from their own site.
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.