Every reverse proxy is a parser. So is every application server sitting behind it. Most of the time the two agree about where one HTTP request ends and the next one begins, and nothing interesting happens. Request smuggling is the name for what happens when they don’t.

The bug lives in the framing. Most defenses inspect payloads, which is why they miss it.

Where the parsers meet

A typical deployment looks like this:

client ──TLS──> CDN / load balancer ──HTTP/1.1──> origin
                 (auth, routing,           (application,
                  rate limits)              business logic)

The front end makes decisions. It authenticates the user, applies rate limits, decides whether /admin is reachable, and forwards the request. The back end trusts that whatever arrives has already been through that gauntlet.

Both components read the same bytes off a reused connection. If they disagree about message boundaries, the front end’s decisions apply to a different sequence of requests than the one the back end executes.

Connection reuse is the delivery mechanism. Without keep-alive or a backend connection pool, a desynchronized parser would only corrupt its own connection and the damage would stop there. With pooling, the bytes left over by one client can prefix the request of the next.

Content-Length and chunked encoding

HTTP/1.1 has two framing mechanisms, and they were never meant to appear together.

Content-Length is a decimal byte count. The receiver reads exactly that many bytes after the header block and calls it a body. It cannot stream a body whose length is not known in advance.

Transfer-Encoding: chunked sends the body as a sequence of chunks:

8\r\n
SMUGGLED\r\n
0\r\n
\r\n

The hex number is the chunk size in bytes. Each chunk’s data is followed by CRLF. A zero-length chunk ends the body, and an optional trailer section follows before the final blank line.

RFC 9112 is clear about the collision: if a message carries both headers, Transfer-Encoding wins, the Content-Length must be removed before forwarding, and a server that receives both “ought to be handled as an error.” The word “ought” is doing a lot of work in real deployments. Different languages, different HTTP libraries, different middleware layers, and a few decades of lenient parsing mean the message that one hop considers malformed is often accepted by the next. Any disagreement between the two parsers is enough to work with.

CL.TE: front end counts, back end chunks

Take this request:

POST /search HTTP/1.1
Host: shop.example
Content-Length: 44
Transfer-Encoding: chunked

0

GET /admin HTTP/1.1
Host: internal

A front end that honors Content-Length reads 44 bytes of body, forwards the request, and considers the transaction finished. A back end that honors Transfer-Encoding reads the 0 chunk, consumes the empty trailer, and ends the request right there. The GET /admin is still in the socket buffer. It is a complete request, and the back end will parse it as the next one on that connection. The front end authorized the first request and never logged the second one.

A more common shape leaves an incomplete prefix instead of a full request:

POST / HTTP/1.1
Host: shop.example
Content-Length: 13
Transfer-Encoding: chunked

0

SMUGGLED

Here the 13 bytes are 0\r\n\r\nSMUGGLED. The front end forwards them. The back end ends the chunked body at 0\r\n\r\n and leaves SMUGGLED in the buffer, where it becomes the first bytes of whichever request arrives next. That request now starts with SMUGGLEDGET /... and usually ends in a 400. Replace the filler with a crafted partial request and the next request on the connection becomes an extension of the attacker’s.

The attack takes its name from which side uses which framing. In CL.TE, the front end uses Content-Length and the back end uses chunked encoding.

TE.CL: the same trick, reversed

POST / HTTP/1.1
Host: shop.example
Content-Length: 3
Transfer-Encoding: chunked

8
SMUGGLED
0

The front end sees chunked, reads an 8-byte chunk and the terminating zero chunk, and forwards the whole thing. The back end sees Content-Length: 3, reads 8\r\n as the body, and leaves SMUGGLED\r\n0\r\n\r\n behind.

The leftover here begins with chunk data, which limits what the attacker can place there. A real TE.CL payload sizes the chunk so that its contents start with a valid request line, and arranges for the trailing chunk terminator to fall inside the request that follows. It is fiddlier than CL.TE but the principle is identical.

When both ends support chunked encoding but disagree about whether a particular Transfer-Encoding header counts, the variant is called TE.TE. The disagreement moves from “which framing wins” to “is this header even valid,” which opens more room than it sounds.

Header obfuscation

Parsers disagree about malformed input long before they disagree about RFC semantics. A few variants that have caused real splits:

Header as sentWhy parsers diverge
Transfer-Encoding: chunkedThe baseline. Everyone agrees.
Transfer-Encoding : chunkedWhitespace before the colon is invalid, but plenty of parsers trim it while others ignore the header entirely.
Transfer-Encoding: xchunkedNot a registered coding. Some parsers reject it, some treat it as unknown and fall back to Content-Length.
Transfer-Encoding: chunked, identitychunked is not the final coding, which the RFC forbids. Some normalize, some reject, some pick the first token.
Two Transfer-Encoding headersOne parser uses the first, another the last, another joins them.
Content-Length: 5, 5Duplicate or list-valued lengths are handled differently: first value, last value, or rejection.
Transfer-Encoding:\tchunkedTab instead of space. Same story as the space-before-colon case.

None of these should be accepted by a strict implementation. In practice, the front end is often an appliance or CDN edge with its own parser, the back end is Node, Python, Java, or Go, and the two were never tested against each other with hostile input.

HTTP/2 changes the framing rules, which is why “we use HTTP/2” feels like an answer. It isn’t, unless the upgrade is end to end. An edge that terminates HTTP/2 and speaks HTTP/1.1 to the origin has to translate, and translation is where H2.CL and H2.TE appear: the client sends a content-length header inside HTTP/2, the edge copies it into the HTTP/1.1 request, and the origin now sees two framing signals again.

What the attacker gets

The leftover bytes are a write primitive into the back end’s request stream. The first effect is an access control bypass: the front end authorizes one request and the back end executes another. If /admin is blocked at the edge but reachable from the origin’s network segment, a smuggled GET /admin never passes through the edge’s rules, and authentication checks that live in the proxy become decorative.

The same primitive captures credentials. Smuggle a request whose body is declared much larger than the bytes sent. The next request on that backend connection, usually a real user’s request with cookies and headers, gets appended to the attacker’s body and stored wherever that endpoint writes data. A login form or a support contact endpoint is enough, and the attacker later reads the captured request from the application itself.

Behind a shared cache, the smuggled prefix can make the cache store the attacker’s response under a legitimate URL. The next visitor gets the poisoned object, which is a much larger blast radius than one connection.

There is also the plain response-queue confusion: the back end produces two responses for one front-end request. Depending on how the proxy maps responses to requests, the attacker’s second request can receive the response intended for someone else. Even without a cache in the path, that is a data leak.

Testing safely

Detection is mostly differential. You send a request that one parser considers complete and the other considers incomplete, then measure what happens. If the back end is left waiting for bytes that will never arrive, the response is delayed until a timeout, and that delay is the signal.

For a suspected CL.TE pair, send a chunked body that declares a chunk larger than what you provide:

POST /probe HTTP/1.1
Host: target.example
Content-Length: 4
Transfer-Encoding: chunked

1
A

A front end using Content-Length forwards the four bytes and waits for the response. A back end using chunked encoding reads a one-byte chunk, then waits for the CRLF that should follow it, which never comes. The request hangs. If the same request returns immediately, the pair is probably not CL.TE.

For TE.CL, invert it: declare a Content-Length larger than the chunked body you send, for example 50, while the body is the five bytes 0\r\n\r\n. A chunked front end considers the body complete and forwards it. A length-counting back end waits for 45 more bytes.

A few practical rules keep this from becoming an outage:

  • Test against your own deployment, with a unique marker header so you can find the traffic later.
  • Use an absurdly short timeout and a single connection. Do not run timing probes in parallel; you will measure your own queueing.
  • Confirm the delay is reproducible and lands near a known timeout value rather than varying with load.
  • Treat a single 400 or 501 as inconclusive. WAFs, rate limiters, and request-size caps produce those too.
  • Do not test with a payload that captures real user traffic unless you have written authorization and a way to delete what you collect.

PortSwigger’s HTTP Request Smuggler extension automates the permutations, and the research by James Kettle is still the best description of the exploitation space. Both are worth reading before pointing anything at a production pair.

Mitigations that miss the cause

A WAF is at the wrong layer. By the time it inspects a request, the edge parser has already decided where that request ends. The smuggled bytes are, from the WAF’s point of view, part of a body it may not even inspect, or a second request it never sees.

TLS is irrelevant. The bytes are authenticated and encrypted; they are also perfectly legal HTTP as far as each individual parser is concerned.

Disabling backend keep-alive works, in the sense that it removes the shared queue. It also removes most of the performance benefit of having a proxy, and it doesn’t help if the desync is between two internal hops.

“Use HTTP/2” only helps if every hop speaks it natively. Any HTTP/1.1 downgrade puts the ambiguity back, and H2.CL/H2.TE are the proof.

What to change

The durable fixes are parser-level and deployment-level, not payload-level:

  1. Reject any request carrying both Content-Length and Transfer-Encoding with a 400. Do it at every hop that parses HTTP.
  2. When forwarding, remove Content-Length if Transfer-Encoding is present, exactly as RFC 9112 requires.
  3. Reject whitespace before the header colon, duplicate conflicting Content-Length headers, and unknown transfer codings. Strictness is a feature here.
  4. Run the same HTTP parser on both sides of every trust boundary, or at least test the two you have as a pair rather than in isolation.
  5. Prefer HTTP/2 end to end and audit what your edge does when it downgrades.
  6. Watch for bursts of 400s, 408s, and aborted backend connections. A desync in progress looks like a parser arguing with itself.

You cannot prove the absence of this bug by reading one codebase, because it lives in the seam between two implementations. What matters is how many parsers see this byte stream and whether anyone has evidence that they agree.