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
Hostheader 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 (Detectify, Wiz, 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 (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-Protouse 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) (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 asHostby the back end (AWS API Gateway, S3 behind Varnish/Akamai) (Intruder, 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 (Discourse).
- Query parameters the cache excludes. Values ignored by the key but used by the server-side fragment cache (IBM Dynacache) (Webshops); parameter cloaking and parameter pollution (WCVS).
- Request body and method. Fat GET (a body on a GET the cache ignores) and method-override headers (WCVS, 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) (WCVS, HExHTTP).
- Caller identity. In API and GraphQL caches the unkeyed input can be the
Authorizationcontext itself: one caller’s private response served to another (Kong GHSA). - Key construction bugs. Even a declared
Varyheader can be keyed wrongly: Django’sCacheMiddlewareproduced one key for “header absent” and “header present but empty”, which RFC 9111 treats as different requests (Yaam Labs).
What to check
- List every request input the handler reads (headers, cookies, params, body) and compare it with the cache key and
Varyfor that route. - Does URL generation (links, canonical,
Location, assetsrc) depend onHostor forwarding headers? Is that trust limited to a known proxy (Forwarded without question)? - Do front ends drop malformed or duplicate header names before forwarding (Intruder)?
- Are preference cookies (theme, locale, scheme) validated and either keyed or ignored by app-level caches (Discourse)?
- For API/GraphQL gateway caches: is caller identity in the key (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 (Detectify, Tib3rius, Param Miner).
- Map which key components (e.g. User-Agent,
Accept, scheme) victims vary on, since that sets reach (Discourse).
Notable cases
- Discourse —
color_scheme_idcookie 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 (Discourse). - IBM WebSphere Commerce webshops — reflected XSS stored in Dynacache and served across thousands of shops (Webshops).
- AWS API Gateway behind CloudFront — mutated
Hostheader selected an attacker’s API while the cache keyed the victim’s host, allowing any cache entry to be overwritten (Intruder). - AWS S3 + Varnish/Akamai — control-character
Hostheader treated as unkeyed by the cache but honoured by S3; now fixed (HTTP parsers). Forwardedheader — duplicate bug-bounty finding of cached absolute links pointing to attacker hosts, plus cached redirect loops in the wild (Forwarded without question).- Kong
graphql-proxy-cache-advanced— caller identity omitted from the key, CVE-2026-92442 (Kong GHSA). - Django
CacheMiddleware— absent vs emptyVaryheader collapsed into one key, H1 #4062511, low (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 (Discourse).
- Declare variance with
Varyfor headers that legitimately change output (e.g.Vary: Originfor dynamic CORS) (OWASP HTTP Headers), and make sure the cache keys absent and empty values distinctly (Yaam Labs). - Frameworks: disable
Forwarded/X-Forwarded-*handling unless a trusted proxy sets and overwrites them; Cloudflare’s default key includesForwardedandX-Forwarded-*, which blocks many of these exploits (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 (Intruder).
- API gateways: include authenticated identity in every cache key for non-public data, or do not cache authenticated responses (Kong GHSA).
- Mark private responses
Cache-Control: no-store/privateso they never enter shared caches (OWASP HTTP Headers). - Encode request-derived values before rendering, so even a cached reflection is inert (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
- 10 Types of Web Vulnerabilities that are Often Missed (Detectify) · original
- Web AppSec Interview Questions (Tib3rius) · original
- Avoiding security incidents due to request collapsing (Wiz) · original
- Forwarded without question: how web frameworks overtrust the Forwarded header · original
- Practical HTTP Header Smuggling (Intruder) · original
- (Research) Exploiting HTTP Parsers Inconsistencies · original
- A JPEG, a Race, and a Ghost: Breaking Discourse's Image Pipeline · original
- How I found a stored XSS on thousands of webshops · original
- Kong graphql-proxy-cache-advanced leaks cached responses across callers · original
- Bug Bounty Roundup: 15 Disclosed HackerOne Reports (Yaam Labs) · original
- PortSwigger/param-miner · original
- Hackmanit Web Cache Vulnerability Scanner · original
- HExHTTP: Header Exploitation HTTP · original
- OWASP HTTP Headers Cheat Sheet · original