Skip to content
Cache bugs Write-up Intermediate

*Web Cache Poisoning to Exploit a DOM Vulnerability via a Cache With Strict Cacheability Criteria*

The application uses the X-Forwarded-Host header to build a JSON URL for geolocation data, and the cache stores responses without validating this header. An attacker can poison the cache so that all users load a malicious JSON file from an attacker-controlled server, leading to DOM-based XSS.

Bash Overflow Follow

Published on infosecwriteups.com

This lab demonstrates how a DOM-based vulnerability can be weaponized through web cache poisoning, even when the cache enforces strict cacheability rules. At its core, the issue arises because the cache does not sufficiently validate untrusted input before storing and serving responses.

Bash Overflow, on infosecwriteups.com

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 application uses the X-Forwarded-Host header to construct a URL for fetching geolocation data, and the cache does not validate or exclude this header from the cache key, allowing cache poisoning.

Impact

The poisoned cache could serve malicious content to many users, leading to DOM-based XSS that executes in their browsers.

What the attacker needed

Cache stores responses without validating X-Forwarded-Host; attacker can host a malicious JSON file; victim visits the poisoned page

How it was found

  1. Capture the homepage request and the requests for geolocate.js and geolocate.json in Burp Proxy.
  2. Inspect geolocate.js to see that it builds the JSON URL using data.host.
  3. Use Param Miner to guess headers that influence the response.
  4. Add an X-Forwarded-Host header pointing to the exploit server and send the request repeatedly to poison the cache.
  5. Host a malicious geolocate.json on the exploit server with a country value containing an XSS payload.
  6. If CORS blocks the JSON fetch, add Access-Control-Allow-Origin: * to the exploit server 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 web cache stores copies of pages to serve them faster. Here, the server trusted a header called X-Forwarded-Host to decide where to fetch a JSON file, and the cache saved that decision. An attacker could make the cache store a page that points to their own server, so every visitor's browser runs malicious code.

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.

More by Bash Overflow

View all

35 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Web cache poisoning and deception

The lesson behind this report.

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.