A proxy chain is a parser chain. Each hop decides where a request starts and ends, and the next hop trusts those bytes. If Content-Length, Transfer-Encoding or duplicate headers make two hops disagree, an attacker can hide one request inside another.
HTTP/1.1 permits a body to be delimited by Content-Length or chunked Transfer-Encoding, but not ambiguously by both. Proxies and servers often normalize, reject or prefer different headers. When the front-end uses one boundary and the back-end uses another, bytes inside a body become a new request at the back-end, or a legitimate request is consumed as body. The result is a desynchronized connection that can bypass front-end authorization, poison the next response or reach internal routes.
Each team trusts its own parser and assumes the other hop sees the same request. The attacker exploits the gap between two correct-looking implementations.
What is actually at stake?
Before touching a payload, map the assets, the actors and the boundary that is supposed to protect them. A finding only becomes a vulnerability when you can connect the failed boundary to a real asset.
Assets
- Routes that are reachable only from the internal network
- Other users' requests and responses on a shared back-end connection
- Authentication and authorization decisions made at the edge
- Caches and queues that store responses keyed by the front-end request
- Admin endpoints, health checks and internal metadata services
Actors
- External attacker who can send raw HTTP to the edge
- Authenticated low-privilege user who can reach a proxy-protected route
- Attacker who can race or queue a request before a victim's request
- Malicious client on a shared connection or load balancer
Trust boundaries
- Client to CDN or load balancer
- CDN to reverse proxy
- Reverse proxy to application server
- Application server to internal service mesh
- HTTP/2 edge to HTTP/1.1 origin
Abuse cases
- Use Content-Length and Transfer-Encoding together so the front-end and back-end choose different bodies
- Duplicate Content-Length headers with different values and rely on first-versus-last parsing
- Obfuscate Transfer-Encoding so one hop ignores it and falls back to Content-Length
- Hide a GET /admin/secret request inside the body of a permitted POST
- Prefix the next victim request with attacker-controlled method, path or headers
Follow the decision, not the payload
Every family has a moment where trusted data becomes an authorization, parsing or state decision. Learn to point at that moment in the request path.
- 01
Frame
The client sends headers that can be read in more than one way: both CL and TE, duplicate CL, or an obfuscated TE value.
- 02
Normalize
The front-end accepts or rewrites the headers according to its parser and computes a body boundary.
- 03
Forward
The proxy forwards bytes to a reused back-end connection, preserving or rewriting the ambiguous framing.
- 04
Reinterpret
The back-end applies a different rule, ends the body earlier or later, and parses the remaining bytes as a new request.
- 05
Desync
The hidden request runs with back-end trust, or the next victim request is consumed or prefixed, producing unauthorized access or response queue poisoning.
HTTP desync attacks and the revival of request smuggling
James Kettle, HTTP Desync Attacks: Request Smuggling Reborn, 2019James Kettle's 2019 research showed that request smuggling was not limited to obscure CDNs. Many modern reverse proxies and origins disagreed about CL/TE framing, duplicate headers and HTTP/2 downgrades, and the bugs were exploitable at scale.
The research used timing and differential probes to detect parser disagreements, then crafted CL.TE, TE.CL and TE.TE payloads that hid a second request inside the first. Some chains allowed cache poisoning, credential capture and access to internal routes.
Depending on the chain, an attacker could bypass front-end authorization, poison cached responses, capture other users' requests or reach internal admin endpoints. Exploitation often required only a single crafted request.
Each hop implemented HTTP framing correctly in isolation but differently from its neighbor. Front-end checks were applied to one request while the back-end executed another.
Reject ambiguous framing at every hop, use a single HTTP version end-to-end where possible, disable back-end connection reuse after malformed requests, and test the deployed proxy chain continuously.
Read it as a chain: discovery → failed decision → impact → fix. Then ask which link would have broken earliest.
A repeatable testing sequence
- Map every hop: CDN, load balancer, reverse proxy and application server, including their HTTP versions.
- Send ambiguous Content-Length and Transfer-Encoding combinations and compare timeout, status and response boundaries.
- Use a timing or differential probe to learn which hop trusts which header before crafting the final payload.
- Hide a complete request inside the body the front-end accepts and the back-end ends early.
- Prove the impact with a back-end-only route, a poisoned next response or a request from another user, then document the exact parser disagreement.
Where smart people get fooled
- Sending two ordinary pipelined requests is not smuggling; the front-end must treat the hidden request as body bytes.
- A single-server deployment with one HTTP parser may normalize the ambiguity, so test the actual proxy chain.
- TLS or HTTP/2 at the edge can still desync after an HTTP/1.1 downgrade to the origin.
- A payload that only causes a timeout may be a parser stall, not proof of a second request; confirm with a differential response.
What would the logs show?
A control is stronger when someone can see it fail. These signals are starting points for a detection rule, not a complete SIEM use case.
- Requests containing both Content-Length and Transfer-Encoding
- Duplicate Content-Length or Transfer-Encoding headers with different values
- Transfer-Encoding values with unusual casing, whitespace, comments or xchunked suffixes
- Back-end responses that arrive out of order or with mismatched request IDs
- Front-end 200 responses followed by origin logs showing a different method or path
index=proxy sourcetype=http | eval cl=if(match(raw, "(?i)content-length:"),1,0) | eval te=if(match(raw, "(?i)transfer-encoding:"),1,0) | eval dup=if(match(raw, "(?i)(content-length:[^\n]+){2,}") OR match(raw, "(?i)(transfer-encoding:[^\n]+){2,}"),1,0) | where (cl=1 AND te=1) OR dup=1 | stats count values(uri) values(src_ip) by host, statusFix the decision, then prove it stays fixed
- Use one HTTP version and one parser chain where possible, and reject requests with both Content-Length and Transfer-Encoding.
- Normalize or reject duplicate Content-Length, duplicate Transfer-Encoding and obfuscated header names at the edge.
- Disable back-end connection reuse when a request is ambiguous, and make the origin reject malformed framing.
- Test the deployed proxy chain with CL.TE, TE.CL, TE.TE and duplicate-CL probes in CI, not only in a lab.
const length = Number(req.headers['content-length'] ?? 0);
const body = readExactly(req, length);
return forwardToOrigin(req.method, req.url, req.headers, body);const hasCl = req.headers['content-length'] !== undefined;
const hasTe = req.headers['transfer-encoding'] !== undefined;
if (hasCl && hasTe) return reject(400, 'ambiguous framing');
if (hasTe && !/^chunked$/i.test(String(req.headers['transfer-encoding']))) return reject(400, 'unsupported transfer-encoding');
if (hasCl && !/^\d+$/.test(String(req.headers['content-length']))) return reject(400, 'invalid content-length');
const body = hasTe ? readChunked(req) : readExactly(req, Number(req.headers['content-length'] ?? 0));
return forwardToOrigin(req.method, req.url, sanitizedHeaders(req.headers), body);Reject ambiguity before parsing a body. Use one canonical parser chain, never forward both CL and TE, normalize header names and values at the edge, and close the back-end connection after any malformed or rejected request.
Regression tests a reviewer would ask for
CL and TE together are rejected
GivenA request with Content-Length: 3 and Transfer-Encoding: chunked
WhenIt reaches the front-end
ThenThe edge returns 400 and does not forward a body to the origin
Duplicate CL is rejected
GivenTwo Content-Length headers with different values
WhenThe proxy parses the request
ThenThe request is rejected instead of choosing first or last
Obfuscated TE is rejected
GivenTransfer-Encoding: xchunked or a header name with unusual whitespace
WhenThe edge normalizes headers
ThenThe request is rejected or canonicalized to one supported value
Back-end connection is not reused after ambiguity
GivenA malformed request that reaches the origin
WhenThe origin responds with an error
ThenThe proxy closes the back-end connection and a following request uses a fresh one
What this finding is not
Strong testers kill their own findings before someone else does. These are the shortcuts that turn a real bug into a weak report — or a false alarm into a wasted escalation.
- Two ordinary pipelined requests reach the origin; the front-end also sees two requests, so no boundary was crossed.
- A request with both CL and TE is rejected with 400 by every hop; rejection is the secure behavior, not a finding.
- A timing difference appears only under load or with a single malformed request and cannot be reproduced with a differential probe.
- The hidden path returns a generic 404 from the edge itself, not a back-end-only response.
Terms you should be able to use precisely
- CL.TE
- A desync where the front-end uses Content-Length and the back-end uses Transfer-Encoding, or the reverse; always name the hop, not just the pair.
- TE.CL
- A desync where the front-end uses Transfer-Encoding and the back-end uses Content-Length, or the reverse.
- TE.TE
- A desync caused by two Transfer-Encoding headers or obfuscated values that different hops interpret differently.
- Desynchronization
- A state where the front-end and back-end disagree about the boundary between requests on a reused connection.
- Response queue poisoning
- A desync effect where one user receives a response intended for another user because the response order no longer matches the request order.
- HTTP/2 downgrade
- Rewriting an HTTP/2 request to HTTP/1.1 at the origin, which can reintroduce CL/TE ambiguity if headers are copied carelessly.
Answer these without reciting a payload
Why is rejecting both Content-Length and Transfer-Encoding the correct behavior?
The combination is ambiguous and different hops may choose different boundaries. Rejection prevents a desync instead of guessing which header is authoritative.
How do you detect request smuggling without exploiting it?
Send differential probes for CL.TE, TE.CL, TE.TE and duplicate CL, compare timing and response boundaries, and check whether the origin logs a different request than the edge. Confirm with a safe internal marker rather than attacking a real user.
Why is a single-server test not enough?
Smuggling lives in the disagreement between hops. A single parser may normalize the request consistently, while the production CDN, proxy and origin do not.
Can you separate the mechanism from the payload?
Four questions, graded on the server. Answers and explanations are released only after you submit, and signed-in learners keep a best score.
Request Smuggling ليست طلبين عاديين في نفس الاتصال، بل اختلاف بين hopين حول أين ينتهي جسم الطلب. عندما ترى الواجهة الأمامية طلبًا واحدًا ويرى الخادم الخلفي طلبًا ثانيًا مخفيًا داخل الجسم، يمكن تجاوز تفويض الحافة أو تسميم استجابة المستخدم التالي. الأسباب: Content-Length مع Transfer-Encoding، رؤوس مكررة، قيم TE مشوهة، أو تحويل HTTP/2 إلى HTTP/1.1. الحل: ارفض الالتباس عند كل hop، طبّع الرؤوس، لا تعد استخدام الاتصال الخلفي بعد طلب مشبوه، واختبر السلسلة الفعلية لا المكتبة فقط.
If every hop used the same HTTP library and version, would request smuggling disappear or move to a different boundary?