HTTP Request Smuggling Explained: The Bug That Poisons Shared Connections


Modern websites rarely have one server. A front-end (load balancer, CDN or proxy) receives your request and forwards it to a back-end server. Both servers must agree on where one request ends and the next begins. When they disagree, an attacker can smuggle a second, hidden request inside the first one — and the back-end will happily execute it. That is HTTP request smuggling, and it is one of the most powerful bugs in web security.

How the Desync Happens

HTTP decides request length in two ways: the Content-Length header (the body is exactly N bytes) and Transfer-Encoding: chunked (the body comes in chunks ending with a zero-length chunk). Trouble starts when a request contains both, or a malformed version of one — and the front-end trusts one while the back-end trusts the other.

Imagine this request hitting the front-end:

POST /search HTTP/1.1
Host: example.com
Content-Length: 13
Transfer-Encoding: chunked
0
GET /admin HTTP/1.1

The front-end reads Transfer-Encoding: chunked, sees the 0 chunk, and thinks the request is over — forwarding everything to the back-end as one request. The back-end reads Content-Length: 13, treats only the first 13 bytes as the body, and the leftover GET /admin becomes the start of the next request — attached to whatever innocent user sends the next request on that shared connection.

Why It Is So Dangerous

The smuggled request inherits the next victim’s session. That means:

  • Cache poisoning — smuggle a request that makes the server cache a malicious response, served to everyone.
  • Account takeover — poison the next user’s request to redirect them, or steal their session.
  • Bypassing security controls — the front-end never sees the smuggled request, so WAFs and access controls are skipped entirely.
  • Stealing other users’ responses — in some variants, the attacker reads the response meant for someone else.

This is not theory. Request smuggling has earned large bug bounty payouts and appears in real-world breaches, precisely because it hides in the gap between two systems that each think they are correct.

The Variants You Will See

  • CL.TE — front-end uses Content-Length, back-end uses Transfer-Encoding.
  • TE.CL — the reverse, and the most common in the wild.
  • TE.TE — both use Transfer-Encoding, but one can be tricked into ignoring a malformed variant (like Transfer-Encoding: xchunked).
  • CL.0 / 0.CL — one server ignores Content-Length entirely.

How to Hunt It (Legally)

  1. Use PortSwigger’s Web Security Academy — it has free, legal labs for every smuggling variant, with a built-in detection methodology. Practice there, never on live sites without permission.
  2. Send a timing probe. A classic detection trick: smuggle a request that makes the back-end wait (for example, a request to a slow endpoint). If your next request is delayed, the servers are desynced.
  3. Check the response. Smuggled requests often produce a visible error, a strange redirect, or a response that belongs to a different request.
  4. Report it properly. In a bug bounty report, show the exact request, the delayed/confused response, and the impact — a clear proof of concept is what gets paid.

How to Defend Against It

  • Use HTTP/2 end to end where possible — its framing removes this entire class of ambiguity.
  • Reject ambiguous requests. Modern servers and proxies can be configured to drop requests containing both Content-Length and Transfer-Encoding.
  • Keep your front-end and back-end aligned — same server software, same parsing rules, and a WAF that normalizes requests before forwarding.
  • Patch and update. Proxy and server vendors regularly fix parsing quirks; staying current closes known desync vectors.

Request smuggling is a reminder that security bugs don’t always live in your code — sometimes they live in the gap between two systems. Learn to see those gaps, and you will find bugs other hunters walk straight past. Only test systems you own or have written permission to test.

Comments

Popular Posts