Skip to content
Cache bugs Write-up Intermediate

Mapping the Attackers Before Mapping the Application

The CDN edge cache endpoint ignored the X-Forwarded-Host header when building its cache key, so an attacker could poison the cache with a response that referenced an external script. The same header could also be pointed at an internal host, causing the cached response to include user data such as an email and token.

medium.com

Published on medium.com

Free link 🎈

Iski, 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

Likely the cache key did not include the X-Forwarded-Host header, while the backend used that header to build the response.

Impact

An attacker could poison the cache so that every user visiting the affected endpoint received attacker-controlled JavaScript, potentially leading to session hijacking or token theft; the same technique could also expose cached user data.

What the attacker needed

Ability to send requests with custom headers; victim visits the poisoned endpoint

The fix

The cache key should include all headers that influence the response, such as X-Forwarded-Host, and the backend should not trust client-supplied forwarding headers.

How it was found

  1. Send a request to the cache render endpoint with an X-Forwarded-Host header pointing to an attacker-controlled domain.
  2. Observe that the response contains a script tag referencing that domain.
  3. Send a clean request without the header and confirm the poisoned response is still returned from cache.
  4. Point the X-Forwarded-Host header at an internal hostname and request a user-profile template.
  5. Observe that the response contains user data such as an email address and a token.

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 fast storage layer that keeps copies of responses so they can be served quickly to many users. Here the cache decided what to store based only on the URL path, ignoring a header that told the backend which host to use. An attacker could therefore make the cache store a response containing their own script or internal data, and everyone else would get that stored copy.

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.

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.