HTTP request smuggling

On this page 7

HTTP request smuggling is an attack that exploits disagreement between two HTTP processors in a chain, typically a front-end proxy and a back-end server, about where one request ends and the next begins. In application security and wider cybersecurity, it is classed as a desynchronization flaw: the attacker hides a second, partial request inside the body of the first, and the back end treats that hidden fragment as the start of someone else’s request.

The weakness does not live in application code but in the parsing of message boundaries, which is why scanners focused on input validation, SQL injection or XSS rarely find it. When it succeeds, it can bypass access controls, poison caches, capture other users’ sessions and turn a reflected XSS into a stored-like attack.

How request smuggling desynchronizes a connection

Request smuggling works because modern architectures reuse a single TCP or TLS connection between a load balancer, CDN or reverse proxy and the origin server. Many independent client requests travel over that shared connection back to back, so every hop must agree on the exact length of each message body.

HTTP/1.1 offers two ways to state that length: the Content-Length header, which gives a byte count, and Transfer-Encoding: chunked, which sends the body in hex-sized chunks ending with a zero-length chunk. RFC 9112 says that when both headers are present, Transfer-Encoding wins and the message should be treated as suspect. Implementations that deviate from this rule, or that parse malformed headers leniently, create the ambiguity an attacker needs.

The attack follows a predictable sequence:

  1. The attacker sends one request whose headers are read differently by the front end and the back end.
  2. The front end forwards what it believes is one complete request.
  3. The back end stops reading earlier and leaves the leftover bytes in its buffer.
  4. The next request on the connection, often from a legitimate user, is appended to the leftover prefix and processed as a modified request.

Main variants of HTTP request smuggling

Variants are named by which header each component honors. The table summarizes the classic and newer forms that practitioners test for.

VariantFront end usesBack end usesTypical root cause
CL.TEContent-LengthTransfer-EncodingFront end ignores chunked encoding
TE.CLTransfer-EncodingContent-LengthBack end does not support chunking
TE.TETransfer-EncodingTransfer-EncodingOne side rejects an obfuscated header
CL.0Content-LengthAssumes no bodyEndpoint ignores bodies on certain routes
H2.CL / H2.TEHTTP/2 frame lengthInjected HTTP/1.1 headerUnsafe HTTP/2 downgrading
Client-side desyncBrowserSingle serverServer ignores declared body length
Common request smuggling variants

The TE.TE variant relies on header obfuscation such as extra whitespace, duplicate headers or unusual casing, so that one parser accepts the header and the other ignores it. HTTP/2 downgrade attacks emerged because many front ends speak HTTP/2 to clients but rewrite traffic as HTTP/1.1 toward the origin, reintroducing the length ambiguity that HTTP/2 framing was designed to remove.

What an attacker can achieve

The impact depends on what the smuggled prefix does to the victim’s request and on what the front end normally enforces. Because the back end trusts traffic arriving from its proxy, controls implemented only at the edge are the first casualty.

OutcomeMechanismSeverity
Access control bypassSmuggled request reaches admin paths the proxy blocksHigh
Session captureVictim request appended to a body that the attacker later readsCritical
Web cache poisoningWrong response stored for a popular URLHigh to critical
Response queue poisoningResponses shifted between unrelated usersCritical
Reflected XSS deliveryPayload served to a random victim without a linkMedium to high
Impact of successful smuggling

Response queue poisoning is especially damaging because the proxy begins delivering responses to the wrong clients, potentially exposing authenticated pages, tokens and personal data across many users until the connection is closed.

Request smuggling is often confused with other injection and forgery issues, yet its attack surface is the protocol layer, not application logic. The comparison below places it among neighboring concepts in application security.

AttackLayer targetedMain precondition
HTTP request smugglingMessage framing between hopsTwo parsers disagree on length
HTTP response splittingHeader generationUnescaped CRLF in output headers
SSRFServer-side outbound requestsUser-controlled destination URL
CSRFBrowser session trustMissing anti-forgery token
Session hijackingSession identifierToken theft or prediction
Smuggling compared with related attacks

Smuggling can be a delivery path for other attacks: it can carry an SSRF payload past an edge filter or lead to session hijacking by capturing cookies. It also maps to the injection and security misconfiguration categories of the OWASP Top 10 rather than having a category of its own.

Detecting and preventing request smuggling

Detection relies on timing and differential probes. A tester sends a request that would cause the back end to wait for more data if the parsers disagree, then measures a delay of several seconds or confirms the issue by observing that a follow-up request receives an unexpected response. Probes must be sent carefully on production systems, because a confirmed desync can corrupt real users’ traffic.

Prevention removes the ambiguity rather than filtering payloads. Effective measures include:

  • Use end-to-end HTTP/2 between proxy and origin and avoid downgrading to HTTP/1.1 where possible.
  • Configure the front end to normalize ambiguous requests and reject any message carrying both Content-Length and Transfer-Encoding.
  • Reject requests with malformed or duplicated framing headers instead of guessing their meaning.
  • Disable back-end connection reuse when the components cannot be made to parse identically, accepting the performance cost.
  • Run the same server software and version across hops where practical, and patch proxies promptly, because many fixes arrive as parser changes.

A common mistake is relying on a web application firewall alone. A WAF sitting in front of the proxy may itself parse the request differently and simply become another participant in the desynchronization.

Put simply

Imagine two clerks sharing one conveyor belt of letters. The first clerk decides where each letter ends by counting pages, while the second looks for a signature. An attacker sends a letter that the two clerks measure differently, so the second clerk thinks a few extra pages belong to the next letter in line.

That next letter belongs to an innocent customer, and now it starts with the attacker’s pages. HTTP request smuggling is exactly this confusion between web servers that share a connection. The cure is to make every server read message lengths the same way and to reject any letter that looks ambiguous.

In practice

A retail company places a CDN and a reverse proxy in front of an older application server that handles checkout. During an authorized penetration test, a tester sends a request containing both a Content-Length and an oddly spaced Transfer-Encoding header. The proxy forwards the whole body, but the application server honors chunked encoding and leaves a short prefix in its buffer. A follow-up probe returns a 404 response for a page that exists, confirming a TE.CL desynchronization.

Further controlled testing shows that a smuggled prefix could reach an internal administration path that the proxy normally blocks. The team upgrades the proxy, enables strict rejection of requests with conflicting length headers and switches the proxy-to-origin link to HTTP/2. A retest two days later shows no remaining desync, and the finding is closed before any customer traffic was affected.