Skip to content
Cache bugs Write-up Intermediate

How a “Temporary Fix” Became a Permanent Security Disaster

A cache layer trusted the X-Forwarded-Host and X-Original-URL headers, allowing an attacker to poison the cache with a response containing internal configuration data. Subsequent visitors received the poisoned response, exposing production secrets without authentication.

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 was configured to vary its key based on the X-Forwarded-Host header and to honour the X-Original-URL header, allowing an attacker to influence which backend endpoint was cached and what host was considered.

Impact

The poisoned cache response exposed internal configuration data, including database hostnames and feature flags, to any unauthenticated user who requested the endpoint, potentially enabling further attacks.

What the attacker needed

No authentication required; Ability to send custom HTTP headers

The fix

The cache should be configured to not trust client-supplied headers like X-Forwarded-Host and X-Original-URL, and to normalise or ignore them.

How it was found

  1. Send a request to /assets/cache-router with a custom X-Forwarded-Host header.
  2. Observe that the first request results in a cache MISS and the second in a HIT, indicating the response is cached.
  3. Send another request with X-Forwarded-Host set to an internal host and X-Original-URL pointing to an admin API endpoint.
  4. Receive a response containing internal configuration details such as environment, database host, and feature flags.
  5. Note that this response is cached and served to other users who request the same endpoint.

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 temporary storage that saves copies of web responses to serve them faster. Here, the cache was tricked into saving a response that contained sensitive internal information, and then served that saved copy to other users. This means an attacker could see secrets like database addresses and debug settings without needing to log in.

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.