# CL.TE and TE.CL Desync
> Classic HTTP/1.1 request smuggling: the front-end and back-end disagree on whether a body's length comes from `Content-Length` or `Transfer-Encoding: chunked`.
## How it works
HTTP/1.1 gives a message body two length signals. RFC 9112 §6.3 mandates that if both `Content-Length` (CL) and `Transfer-Encoding: chunked` (TE) are present, TE wins and CL is ignored. Smuggling happens when one hop breaks that rule or parses TE differently from its neighbour:
- **CL.TE** — front-end uses `Content-Length` and forwards the whole body; back-end honors `Transfer-Encoding: chunked`, stops at the `0\r\n\r\n` terminator, and treats the trailing bytes as the start of the **next** request on the shared connection.
- **TE.CL** — the mirror image: front-end chunks, back-end uses `Content-Length`, so a short CL leaves the remainder of a chunk as a smuggled prefix.
- **CL.0** — the back-end ignores the body entirely (e.g. because it doesn't expect a body on that method/endpoint), so the whole body becomes the next request. Related **0.CL**: the front-end treats the body as length-zero.
- **TE.TE** — both support TE, but an **obfuscated** TE header (`Transfer-Encoding: xchunked`, a trailing tab/space, line-folding, or a duplicate TE) makes exactly one of them fall back to CL.
The smuggled prefix is then prepended to whichever request next traverses that back-end connection — typically another user's ([[raw/apisec.ai/http-request-smuggling-in-api-gateways-3987|API Gateways]], [[raw/hipotermia.pw/http-request-smuggling-idor-hipotermia-409|Hipotermia]]).
## Techniques / payloads
- **Detection by timeout.** Send a request whose framing makes the back-end block waiting for bytes that never arrive (e.g. a chunked body the front-end truncates). A hang relative to a control request confirms the disagreement — the basis of HTTP Request Smuggler's scan.
- **Confirm with two full requests.** Smuggling exactly two complete, self-contained requests makes the back-end emit two responses; on HTTP/1.1 keep-alive this alone is ambiguous with pipelining, so pair it with a self-targeting prefix first, then escalate ([[raw/portswigger.net/http-2-the-sequel-is-always-worse-6639|HTTP/2: The Sequel]]).
- **Obfuscated TE menu:** `xchunked`, `Transfer-Encoding:[tab]chunked`, space before the colon, `Transfer-Encoding\n: chunked` (bare-LF), two TE headers, and value casing — each targets a parser that string-matches rather than fully parses.
- **The 0.CL deadlock + early-response gadget.** A 0.CL trigger stalls because the back-end waits for a body the front-end won't send. An **early-response gadget** — something that makes the back-end reply before reading the full body (an error page, a redirect, a maxlen) — breaks the deadlock and lets a double-desync follow ([[raw/portswigger.net/advanced-request-smuggling-5092|Advanced request smuggling]]).
- **Illustrative CL.TE shape** (framing only, not a full exploit): a `POST` carrying `Content-Length: N` plus `Transfer-Encoding: chunked` and a `0\r\n\r\n` terminator, after which a second request-line (`GET /admin…`) rides along as the smuggled prefix.
## Notable cases
- **Slack `slackb.com`** — CL.TE, session-cookie theft from other users, automatable; Evan Custodio, $6.5k during a promo window, fixed in 24h ([[raw/medium.com/two-rulers-one-wire-how-an-http-desync-earned-a-first-time-hunter-6-50-14399|Two Rulers, One Wire]]).
- **Hiawatha ≤12.1 (CWE-444)** — the HTTP parser checks `Content-Length` before `Transfer-Encoding` (wrong order per RFC 9112 §6.3) and the reverse-proxy module forwards the request without stripping the original CL; ~6,100 internet-facing instances at disclosure, fixed in 12.2 ([[raw/fenrisk.com/http-request-smuggling-in-hiawatha-10911|Hiawatha]]).
- **IDOR escalation** — a CL.TE desync smuggles `GET /admin7…` so it is processed as the next user's request, turning an object-reference gap into cross-user admin access ([[raw/hipotermia.pw/http-request-smuggling-idor-hipotermia-409|HTTP Smuggling + IDOR]]).
- **HAProxy** — CVE-2023-40225 (empty `Content-Length`) and CVE-2024-53008 (CL/TE inconsistency bypassing ACLs to reach restricted back-end endpoints); CVE-2024-33452 (HEAD with a body) ([[raw/apisec.ai/http-request-smuggling-in-api-gateways-3987|API Gateways]]).
- **First-bug CL.TE writeup** — a worked discovery-to-report example ([[raw/link.medium.com/finding-my-first-bug-http-request-smuggling-1030|Finding My First Bug]]).
## Defenses
- Reject any request bearing both CL and TE, duplicate/empty CL, or obfuscated TE; fully parse TE rather than string-match it.
- Prefer HTTP/2 end-to-end to remove plaintext framing ambiguity ([[HTTP Request Smuggling]] guide).
- Disable back-end connection reuse where HTTP/1.1 upstream is unavoidable.
- Allow-list which methods may carry a body (POST/PUT/PATCH) to kill CL.0.
## Related
- [[HTTP Request Smuggling]] — parent guide.
- [[HTTP2 Downgrade Smuggling|HTTP/2 Downgrade Smuggling]] — H2.CL/H2.TE reintroduce CL vs TE after a downgrade.
- [[Client-Side and Connection-Locked Desync]] · [[API Gateway Security]] · [[Header-Based Access Control Bypass]] · [[Insecure Direct Object Reference]]
## Sources
- [[raw/apisec.ai/http-request-smuggling-in-api-gateways-3987|HTTP Request Smuggling in API Gateways]]
- [[raw/fenrisk.com/http-request-smuggling-in-hiawatha-10911|HTTP Request Smuggling in Hiawatha]]
- [[raw/hipotermia.pw/http-request-smuggling-idor-hipotermia-409|HTTP Request Smuggling IDOR]]
- [[raw/medium.com/two-rulers-one-wire-how-an-http-desync-earned-a-first-time-hunter-6-50-14399|Two Rulers, One Wire: HTTP Desync on Slack]]
- [[raw/portswigger.net/advanced-request-smuggling-5092|Advanced request smuggling]]
- [[raw/portswigger.net/http-2-the-sequel-is-always-worse-6639|HTTP/2: The Sequel is Always Worse]]
- [[raw/link.medium.com/finding-my-first-bug-http-request-smuggling-1030|Finding My First Bug: HTTP Request Smuggling]]
- [[raw/infosecwriteups.com/the-most-overlooked-vulnerability-http-request-smuggling-10910|The Most Overlooked Vulnerability — HTTP Request Smuggling]]