# Unkeyed Inputs > Parts of a request that change what the origin returns but are not part of the cache key, so a response shaped by one request is served to everyone whose request maps to the same key. ## How it works - **Keyed vs unkeyed.** A cache decides whether two requests are "the same" from a cache key, most commonly the `Host` header plus the request line; CloudFront's default is domain + URL path. Every other header, cookie and body byte is unkeyed: it reaches the origin but does not split the cache ([[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-labs-detectify-1874|Detectify]], [[raw/wiz.io/avoiding-security-incidents-due-to-request-collapsing-9595|Wiz]], [[raw/rafa.hashnode.dev/research-exploiting-http-parsers-inconsistencies-990|HTTP parsers]]). - **Why that is dangerous.** If the origin uses an unkeyed value to build the response (reflection, absolute links, redirects, theme or locale selection), the first response for a key is stored and replayed to every later visitor with the same keyed input ([[raw/tib3rius.com/web-appsec-interview-questions-5906|Tib3rius]]). - **Why inputs end up unkeyed.** Keying everything would destroy hit rates, so caches key a minimal set and rely on the origin to declare extra variance via `Vary`. Bugs appear when the origin reads something it never declares, or when a cache layer is added later without reviewing what the app reads. Common classes, by where the value lives: - **Forwarding headers.** Frameworks that trust `Forwarded` / `X-Forwarded-Host` / `X-Forwarded-Proto` use them to build absolute links and redirects. Cached, that sends users to attacker hosts, redirects a script include to attacker JS, or creates an HTTP-to-HTTPS redirect loop (DoS) ([[raw/lkoskela.fi/forwarded-without-question-how-web-frameworks-overtrust-the-forwarded-13489|Forwarded without question]]). - **Host-header parsing differentials.** The cache and origin disagree on which header is `Host`: a mutated or control-character-prefixed header looks like an unkeyed header to the cache but is honoured as `Host` by the back end (AWS API Gateway, S3 behind Varnish/Akamai) ([[raw/intruder.io/practical-http-header-smuggling-sneaking-past-reverse-proxies-to-attac-6537|Intruder]], [[raw/rafa.hashnode.dev/research-exploiting-http-parsers-inconsistencies-990|HTTP parsers]]). See [[URL Parser Differentials]]. - **Cookies.** Application caches that key on path and headers but not on a preference cookie turn a self-XSS into XSS for every anonymous visitor ([[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|Discourse]]). - **Query parameters the cache excludes.** Values ignored by the key but used by the server-side fragment cache (IBM Dynacache) ([[raw/medium.com/how-i-found-a-stored-xss-on-thousands-of-webshops-366|Webshops]]); parameter cloaking and parameter pollution ([[raw/github.com/hackmanit-web-cache-vulnerability-scanner-web-cache-vulnerability-scan-7155|WCVS]]). - **Request body and method.** Fat GET (a body on a GET the cache ignores) and method-override headers ([[raw/github.com/hackmanit-web-cache-vulnerability-scanner-web-cache-vulnerability-scan-7155|WCVS]], [[raw/github.com/portswigger-param-miner-896|Param Miner]]). - **Headers that trigger errors.** Oversized headers, meta characters and hop-by-hop headers that make the origin return an error the cache then stores (CPDoS) ([[raw/github.com/hackmanit-web-cache-vulnerability-scanner-web-cache-vulnerability-scan-7155|WCVS]], [[raw/github.com/github-c0dejump-hexhttp-header-exploitation-http-6585|HExHTTP]]). - **Caller identity.** In API and GraphQL caches the unkeyed input can be the `Authorization` context itself: one caller's private response served to another ([[raw/github.com/kong-graphql-proxy-cache-advanced-leaks-cached-responses-across-caller-14783|Kong GHSA]]). - **Key construction bugs.** Even a declared `Vary` header can be keyed wrongly: Django's `CacheMiddleware` produced one key for "header absent" and "header present but empty", which RFC 9111 treats as different requests ([[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|Yaam Labs]]). ## What to check - [ ] List every request input the handler reads (headers, cookies, params, body) and compare it with the cache key and `Vary` for that route. - [ ] Does URL generation (links, canonical, `Location`, asset `src`) depend on `Host` or forwarding headers? Is that trust limited to a known proxy ([[raw/lkoskela.fi/forwarded-without-question-how-web-frameworks-overtrust-the-forwarded-13489|Forwarded without question]])? - [ ] Do front ends drop malformed or duplicate header names before forwarding ([[raw/intruder.io/practical-http-header-smuggling-sneaking-past-reverse-proxies-to-attac-6537|Intruder]])? - [ ] Are preference cookies (theme, locale, scheme) validated and either keyed or ignored by app-level caches ([[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|Discourse]])? - [ ] For API/GraphQL gateway caches: is caller identity in the key ([[raw/github.com/kong-graphql-proxy-cache-advanced-leaks-cached-responses-across-caller-14783|Kong GHSA]])? - [ ] Do error responses (4xx/5xx from oversized or odd headers) get cached? - [ ] Black-box: use Param Miner "Guess headers/params" or WCVS/HExHTTP to find inputs that change the response, always with a cache buster; confirm by fetching the keyed URL without the input ([[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-labs-detectify-1874|Detectify]], [[raw/tib3rius.com/web-appsec-interview-questions-5906|Tib3rius]], [[raw/github.com/portswigger-param-miner-896|Param Miner]]). - [ ] Map which key components (e.g. User-Agent, `Accept`, scheme) victims vary on, since that sets reach ([[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|Discourse]]). ## Notable cases - **Discourse** — `color_scheme_id` cookie missing from the Redis anonymous-cache key (path, `Accept`, scheme, host, User-Agent) → CSP bypass and JS on every page for anonymous visitors; CVE-2026-55674 ([[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|Discourse]]). - **IBM WebSphere Commerce webshops** — reflected XSS stored in Dynacache and served across thousands of shops ([[raw/medium.com/how-i-found-a-stored-xss-on-thousands-of-webshops-366|Webshops]]). - **AWS API Gateway behind CloudFront** — mutated `Host` header selected an attacker's API while the cache keyed the victim's host, allowing any cache entry to be overwritten ([[raw/intruder.io/practical-http-header-smuggling-sneaking-past-reverse-proxies-to-attac-6537|Intruder]]). - **AWS S3 + Varnish/Akamai** — control-character `Host` header treated as unkeyed by the cache but honoured by S3; now fixed ([[raw/rafa.hashnode.dev/research-exploiting-http-parsers-inconsistencies-990|HTTP parsers]]). - **`Forwarded` header** — duplicate bug-bounty finding of cached absolute links pointing to attacker hosts, plus cached redirect loops in the wild ([[raw/lkoskela.fi/forwarded-without-question-how-web-frameworks-overtrust-the-forwarded-13489|Forwarded without question]]). - **Kong `graphql-proxy-cache-advanced`** — caller identity omitted from the key, CVE-2026-92442 ([[raw/github.com/kong-graphql-proxy-cache-advanced-leaks-cached-responses-across-caller-14783|Kong GHSA]]). - **Django `CacheMiddleware`** — absent vs empty `Vary` header collapsed into one key, H1 #4062511, low ([[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|Yaam Labs]]). ## Defenses - **Key what you use, or stop using it.** If an input changes the response, add it to the key (Discourse's fix also added strict integer validation) or strip it at the edge ([[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|Discourse]]). - **Declare variance with `Vary`** for headers that legitimately change output (e.g. `Vary: Origin` for dynamic CORS) ([[raw/cheatsheetseries.owasp.org/http-headers-6630|OWASP HTTP Headers]]), and make sure the cache keys absent and empty values distinctly ([[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|Yaam Labs]]). - **Frameworks:** disable `Forwarded` / `X-Forwarded-*` handling unless a trusted proxy sets and overwrites them; Cloudflare's default key includes `Forwarded` and `X-Forwarded-*`, which blocks many of these exploits ([[raw/lkoskela.fi/forwarded-without-question-how-web-frameworks-overtrust-the-forwarded-13489|Forwarded without question]]). - **CDN / proxy:** don't forward malformed header names (AWS API Gateway's fix; Cloudflare refuses names with spaces); avoid "forward all headers" policies like CloudFront AllViewer unless the origin is safe for them ([[raw/intruder.io/practical-http-header-smuggling-sneaking-past-reverse-proxies-to-attac-6537|Intruder]]). - **API gateways:** include authenticated identity in every cache key for non-public data, or do not cache authenticated responses ([[raw/github.com/kong-graphql-proxy-cache-advanced-leaks-cached-responses-across-caller-14783|Kong GHSA]]). - **Mark private responses** `Cache-Control: no-store` / `private` so they never enter shared caches ([[raw/cheatsheetseries.owasp.org/http-headers-6630|OWASP HTTP Headers]]). - **Encode request-derived values** before rendering, so even a cached reflection is inert ([[raw/medium.com/how-i-found-a-stored-xss-on-thousands-of-webshops-366|Webshops]]). ## Related - [[Web Cache Poisoning]] — parent guide. - [[Web Cache Deception]] — the inverse mismatch. - [[Host Header SSRF]], [[Password Reset Vulnerabilities]] (same forwarded-header root cause), [[URL Parser Differentials]], [[HTTP Request Smuggling]], [[Stored XSS]], [[GraphQL Security]], [[API Gateway Security]], [[Burp Suite Extensions]]. ## Sources - [[raw/labs.detectify.com/10-types-of-web-vulnerabilities-that-are-often-missed-labs-detectify-1874|10 Types of Web Vulnerabilities that are Often Missed (Detectify)]] - [[raw/tib3rius.com/web-appsec-interview-questions-5906|Web AppSec Interview Questions (Tib3rius)]] - [[raw/wiz.io/avoiding-security-incidents-due-to-request-collapsing-9595|Avoiding security incidents due to request collapsing (Wiz)]] - [[raw/lkoskela.fi/forwarded-without-question-how-web-frameworks-overtrust-the-forwarded-13489|Forwarded without question: how web frameworks overtrust the Forwarded header]] - [[raw/intruder.io/practical-http-header-smuggling-sneaking-past-reverse-proxies-to-attac-6537|Practical HTTP Header Smuggling (Intruder)]] - [[raw/rafa.hashnode.dev/research-exploiting-http-parsers-inconsistencies-990|(Research) Exploiting HTTP Parsers Inconsistencies]] - [[raw/slcyber.io/a-jpeg-a-race-and-a-ghost-breaking-discourse-s-image-pipeline-12233|A JPEG, a Race, and a Ghost: Breaking Discourse's Image Pipeline]] - [[raw/medium.com/how-i-found-a-stored-xss-on-thousands-of-webshops-366|How I found a stored XSS on thousands of webshops]] - [[raw/github.com/kong-graphql-proxy-cache-advanced-leaks-cached-responses-across-caller-14783|Kong graphql-proxy-cache-advanced leaks cached responses across callers]] - [[raw/yaamlabs.com/bug-bounty-roundup-15-disclosed-hackerone-reports-incl-basecamp-csp-by-13721|Bug Bounty Roundup: 15 Disclosed HackerOne Reports (Yaam Labs)]] - [[raw/github.com/portswigger-param-miner-896|PortSwigger/param-miner]] - [[raw/github.com/hackmanit-web-cache-vulnerability-scanner-web-cache-vulnerability-scan-7155|Hackmanit Web Cache Vulnerability Scanner]] - [[raw/github.com/github-c0dejump-hexhttp-header-exploitation-http-6585|HExHTTP: Header Exploitation HTTP]] - [[raw/cheatsheetseries.owasp.org/http-headers-6630|OWASP HTTP Headers Cheat Sheet]]