How to fix: Cache Poisoning via Unkeyed Headers
The response shows cache hit indicators (X-Cache: HIT) while also including or reflecting content from headers that may not be part of the cache key (X-Forwarded-Host, X-Original-URL). This configuration can enable cache poisoning attacks.
Why it matters
Web cache poisoning allows an attacker to poison a cached response so that all subsequent users who receive the cached copy get the attacker's injected content. This can enable XSS at scale: the XSS is cached and served to thousands of users without further attacker interaction.
Cache keys determine which requests share a cached response. If a cache serves different responses based on X-Forwarded-Host but doesn't include it in the cache key, an attacker can inject a crafted X-Forwarded-Host that gets cached and served to other users.
How to fix it
- 1Normalize and strip unkeyed headers at the cache layer before forwarding to the origin.
- 2Include all headers that affect the response content in the cache key.
- 3Audit Vary headers to ensure all differentiating headers are included.
- 4Test with Param Miner (Burp extension) to discover unkeyed headers.
Code examples
Cloudflare cache key configuration
// Cloudflare Worker: strip unkeyed headers
addEventListener('fetch', event => {
const request = new Request(event.request);
// Remove headers that affect response but aren't in cache key
request.headers.delete('X-Forwarded-Host');
request.headers.delete('X-Original-URL');
event.respondWith(fetch(request));
});References
Detected automatically by VulnRadar. The check id is cache-poisoning-unkeyed-header, stable across every scan so you can filter or diff on it.
More host validation checks
- HighHost Header Injection Risk
- MediumSymfony Debug Token Header Exposed
- HighHTTP Request Smuggling Indicator
- HighHTTP Basic Authentication Over Non-HTTPS
- MediumASP.NET ViewState Without MAC Protection
- LowSequential Numeric ID in URL (IDOR Risk)
- HighConfirmed Open Redirect via Location Header
- HighConfirmed Open Redirect via Meta Refresh
Questions
- How severe is Cache Poisoning via Unkeyed Headers?
- VulnRadar rates this high severity in the host validation category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id cache-poisoning-unkeyed-header, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Cache Poisoning via Unkeyed Headers map to?
- It maps to CWE-444. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.