Skip to content
Cache bugs Write-up Intermediate

How to Exploit Web Cache Poisoning with an Unkeyed Header Using Param Miner  —  Web Cache…

The web cache processes an unkeyed header (X-Forwarded-Host) and reflects it in the response, allowing an attacker to poison the cache with a malicious script that executes in visitors' browsers.

bashoverflow Follow

Published on bashoverflow.medium.com

Web cache poisoning is a vulnerability that exploits how web caches store and serve responses. Attackers can manipulate cached responses to deliver malicious content to unsuspecting users.

Bash Overflow, on bashoverflow.medium.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 cache key does not include the X-Forwarded-Host header, so the server reflects it in the response and the cache stores the poisoned response for all users.

Impact

If an attacker successfully poisons the cache, every subsequent user visiting the affected page receives the malicious response, which could be used for stealing cookies, session hijacking, or phishing.

What the attacker needed

Access to the lab environment; Burp Suite with Param Miner; an exploit server

The fix

The application should avoid reflecting user-controlled data in cached responses without proper sanitisation and use appropriate cache directives such as Cache-Control: no-store for dynamic content.

How it was found

  1. Open the lab and use Burp Suite to find cacheable responses.
  2. Add a cachebuster parameter to the URL to avoid affecting other users.
  3. Install Param Miner and use Guess Headers to find unkeyed headers.
  4. Identify X-Forwarded-Host as an unkeyed header.
  5. Set X-Forwarded-Host to an exploit server URL and observe the reflected script.
  6. Store a malicious script on the exploit server, resend the request without the cachebuster, and confirm the cache is poisoned.

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 includes a header value that the cache does not consider when storing, an attacker can make the cache store a malicious version. Then every visitor gets that malicious page, which can run harmful JavaScript in their browser.

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 bashoverflow

View all

3 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.