Course contentsShow
← Security
Lesson 1117 of 3,05223. Web Security - Modern Web AttacksFree lesson

Unkeyed Input Discovery and Exploitation

Identifying headers and parameters excluded from cache keys that influence responses, enabling cache poisoning.

Unkeyed Input Discovery and Exploitation

You'll learn how attackers find and abuse HTTP inputs that caches ignore, turning them into poisoning vectors.

The Core Problem

Web caches store responses based on a cache key—typically just the URL path and query string. But web applications often read many more inputs than what's in the cache key: headers like X-Forwarded-Host, User-Agent, or custom parameters. If the application uses these "unkeyed inputs" to generate content, but the cache ignores them when storing responses, you have a poisoning opportunity.

Think of it like a vending machine that only looks at the slot number (keyed), not the coin type (unkeyed). If the machine delivers different items based on coin type but stores based on slot number, you could trick someone into getting the wrong item.

How It Works

  1. Discovery: Test various HTTP headers and parameters to see which ones:

    • Are reflected in the response (appear in HTML, redirects, or links)
    • Are not part of the cache key (send two requests with different values; if both get cached as one, it's unkeyed)
  2. Exploitation: Craft a malicious value in the unkeyed input that poisons the cached response. When victims request the same URL, they receive your poisoned version.

Example scenario:

GET /home HTTP/1.1
Host: example.com
X-Forwarded-Host: evil.com

Response includes: <link href="https://evil.com/style.css">

If X-Forwarded-Host is unkeyed, this poisoned response gets cached for /home, delivering your malicious script to all subsequent visitors.

Detection Strategy

  • Vary headers like X-Forwarded-Host, X-Original-URL, Accept-Language
  • Watch for reflections in Location headers, <script src=>, or inline content
  • Confirm the input isn't part of the cache key

Key Takeaway: Unkeyed inputs are HTTP headers or parameters excluded from cache keys but still processed by applications—finding and exploiting them enables targeted cache poisoning attacks against all users requesting the same cached resource.