Skip to content
Cache bugs Write-up Intermediate

Exploiting Web Cache Poisoning with X-Host Header Using Param Min

The web server cached responses that included the value of an unknown X-Host header without validating it, allowing an attacker to poison the cache with a malicious script. When a victim with a specific User-Agent accessed the poisoned resource, the script executed in their browser.

Bash Overflow Follow

Published on infosecwriteups.com

Web cache poisoning is a sophisticated attack technique where an adversary manipulates how a website’s content is cached, allowing malicious responses to be served to unsuspecting users. This specific lab, hosted by PortSwigger, dives into an advanced variant of cache poisoning that leverages an unknown HTTP header to…

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 server used the value of the X-Host header when generating the cached response without validating or sanitising it, and the cache key did not include this header, so a poisoned response could be served to other users.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, potentially leading to session data leakage or credential theft, though the attack required knowing the victim's User-Agent and the cache had to be hit.

What the attacker needed

Victim uses a specific User-Agent; attacker can host a malicious script; cache must be hit

How it was found

  1. Install the Param Miner extension in Burp Suite.
  2. Send a GET request to the home page and send it to Repeater.
  3. Use Param Miner to guess headers and discover X-Host.
  4. Add X-Host: evil.com and a cachebuster query parameter, then observe that the response reflects evil.com.
  5. Host a malicious JavaScript file on the exploit server and set X-Host to the exploit server address.
  6. Post a comment containing an image pointing to the exploit server to capture the victim's User-Agent, then use that User-Agent in the request and send until X-Cache: hit is returned.

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 web pages to serve them faster. If a page is cached with malicious content, every user who requests that page gets the malicious version. Here, the server trusted an unusual header called X-Host and included its value in the cached page, so an attacker could make the cache store a script that runs 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.

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.