Skip to content
Cache bugs Write-up Intermediate

$7,000 for Poisoning a Cache: Turning One Request Into Stored XSS

The origin server trusted the X-Forwarded-Host header when generating canonical and Open Graph tags, reflecting it without proper encoding, while the CDN cache key ignored that header. An attacker could send one request to poison the cache, causing all subsequent visitors to an affected URL to receive and execute attacker-controlled JavaScript.

T4nv1 Follow

Published on medium.com

Most XSS I find affects exactly one victim per exploit attempt — you need to get a specific payload in front of a specific person. This bug was different in a way that made it more interesting and, honestly, more unsettling to think about: send one request, and every visitor to that URL gets served the malicious…

T4nv1, on 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

The origin server trusted the client-supplied X-Forwarded-Host header when generating HTML without sufficient output encoding, and the CDN cache key excluded that header, so a single poisoned response was cached and served to all visitors.

Impact

Any visitor loading an affected, previously-poisoned URL executes attacker-controlled JavaScript with no interaction beyond normal page navigation, persisting until the cache entry expires or is manually purged; realistic outcomes include session cookie theft, credential phishing overlays, or further payload delivery to a potentially large fraction of the site's organic traffic to that URL.

What the attacker needed

Ability to send requests with custom headers; target URL uses a cache that ignores the header; origin reflects the header without encoding

The fix

The output-encoding fix was shipped within a week and the cache key configuration was updated shortly after, with an audit of other unkeyed headers catching one additional lower-severity instance.

How it was found

  1. Send a request with an arbitrary X-Forwarded-Host header and observe that the canonical link in the response is rewritten to that value.
  2. Send the poisoned request once, then send a clean request without the header and check for a cache HIT to confirm the poisoned response was cached.
  3. Send a request with an X-Forwarded-Host value containing a script tag and observe it reflected unescaped in the Open Graph meta tag.
  4. Create a draft article under a test account to obtain an isolated preview URL.
  5. Repeat the poisoning against that isolated URL and capture evidence of the cached response containing the script tag.
  6. Flush the test cache entry immediately after capturing evidence.

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 cache is a copy of a web page kept so it can be served quickly to many people. The site built its page using a header that visitors can set, but the cache decided which stored page to reuse without looking at that header. So one malicious request could replace the stored page for everyone else, and the injected script would run in their 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 T4nv1

View all

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