Cache Poisoning Detection Techniques
What you'll learn: How to systematically detect whether a web application is vulnerable to cache poisoning attacks.
Now that you understand how cache poisoning works and the damage it can cause, you need reliable methods to discover whether a cache is exploitable. Detection is like testing a door to see if it's locked—you need specific techniques to reveal hidden vulnerabilities.
Core Detection Methods
Cache-Buster Testing
The fundamental technique involves sending requests with unique, random parameters (cache-busters) to ensure you're not seeing stale responses. Think of it like putting a timestamp on each test letter you send—if you get back yesterday's timestamp, you know something's cached.
How it works:
- Add a unique query parameter like
?cb=random123to your requests - Inject your test payload into suspected unkeyed headers
- Request the same resource again (with a different cache-buster)
- If your payload appears without re-sending the malicious header, the cache is poisoned
Response Variation Analysis
This technique compares responses when varying different inputs:
- Keyed inputs (like URL path) should create different cache entries
- Unkeyed inputs (like certain headers) should NOT affect the cache key, but might still influence the response body
- If changing an unkeyed header alters the response, you've found a poisoning vector
Example workflow:
Send identical URLs with different X-Forwarded-Host headers. If the response reflects that header but the URL alone determines caching, you've identified an exploitable unkeyed input.
Timing and Cache Hit Analysis
Monitor response headers like X-Cache: HIT or Age: to confirm when responses are served from cache versus the origin server. A poisoned cache will serve your payload repeatedly with cache hits.
Key Takeaway: Cache poisoning detection relies on cache-buster parameters to isolate tests and response variation analysis to identify unkeyed inputs that influence cached content—these techniques reveal when attacker-controlled data can pollute shared cache entries.