Skip to content
Cache bugs Write-up Intermediate

My First Web Cache Poisoning Bug

A static domain accepted an unkeyed X-Forwarded-Host header, so a crafted request could poison the cache and make other visitors receive a response containing attacker-controlled HTML. The author achieved HTML injection but could not escalate to stored XSS because a WAF blocked it.

Bikram kharal Follow

Published on infosecwriteups.com

Web cache poisoning is an advanced technique where by an attacker exploits the behavior of a web server and cache so that a harmful HTTP response is served to other users.

Bikram kharal, 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 reflected the unkeyed X-Forwarded-Host header into the response without validation, and the cache stored that response under a key that ignored the header.

Impact

Other users could be served a cached response containing attacker-controlled HTML, but escalation to stored XSS was blocked by the AkamaiGhost WAF.

What the attacker needed

Unkeyed X-Forwarded-Host header; cache stores response ignoring that header; victim visits the poisoned URL

How it was found

  1. Intercept a request to the static domain in Burp Suite.
  2. Use the Param Miner extension to scan for unkeyed headers.
  3. Add an X-Forwarded-Host header with an arbitrary domain and observe that it overwrites the original host in the response.
  4. Open the URL in a private browser window and confirm the injected domain still appears.
  5. Try to escalate to stored XSS but fail because of the AkamaiGhost WAF.
  6. Send a request with an X-Forwarded-Host value containing HTML and observe HTML injection in the 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 is a shared storage that keeps copies of web pages so the server does not have to rebuild them for every visitor. If the cache decides which copy to serve based on only part of the request, an attacker can slip in extra information that changes the page, and that poisoned copy is then shown to other people. Here the extra information was a header telling the site which host name to use, and the site put it into the page without checking.

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 Bikram kharal

View all

1 more disclosed report, 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.