|
| 1 | +--- |
| 2 | +title: "CLTE-DESYNC" |
| 3 | +description: "CLTE-DESYNC sequence test documentation" |
| 4 | +weight: 13 |
| 5 | +--- |
| 6 | + |
| 7 | +| | | |
| 8 | +|---|---| |
| 9 | +| **Test ID** | `SMUG-CLTE-DESYNC` | |
| 10 | +| **Category** | Smuggling | |
| 11 | +| **Type** | Sequence (2 steps) | |
| 12 | +| **Scored** | Yes | |
| 13 | +| **RFC** | [RFC 9112 §6.1](https://www.rfc-editor.org/rfc/rfc9112#section-6.1) | |
| 14 | +| **RFC Level** | MUST | |
| 15 | +| **Expected** | `400`, or connection close | |
| 16 | + |
| 17 | +## What it does |
| 18 | + |
| 19 | +This is a **sequence test** that detects actual CL.TE request boundary desynchronization — the classic request smuggling attack. |
| 20 | + |
| 21 | +### Step 1: Poison POST (CL=6, TE=chunked, extra byte) |
| 22 | + |
| 23 | +```http |
| 24 | +POST / HTTP/1.1\r\n |
| 25 | +Host: localhost:8080\r\n |
| 26 | +Content-Length: 6\r\n |
| 27 | +Transfer-Encoding: chunked\r\n |
| 28 | +\r\n |
| 29 | +0\r\n |
| 30 | +\r\n |
| 31 | +X |
| 32 | +``` |
| 33 | + |
| 34 | +The chunked body terminates at `0\r\n\r\n` (5 bytes), but `Content-Length` claims 6 bytes. The extra `X` byte sits right after the chunked terminator. |
| 35 | + |
| 36 | +- If the server uses **TE**: reads the chunked terminator (5 bytes), body done. `X` is leftover on the wire. |
| 37 | +- If the server uses **CL**: reads 6 bytes (`0\r\n\r\nX`), body done. |
| 38 | + |
| 39 | +Either way, `X` may poison the connection. |
| 40 | + |
| 41 | +### Step 2: Follow-up GET |
| 42 | + |
| 43 | +```http |
| 44 | +GET / HTTP/1.1\r\n |
| 45 | +Host: localhost:8080\r\n |
| 46 | +\r\n |
| 47 | +``` |
| 48 | + |
| 49 | +Sent immediately after step 1. If `X` is still on the wire, the server sees `XGET / HTTP/1.1` — a malformed request line that triggers a 400. |
| 50 | + |
| 51 | +## What the RFC says |
| 52 | + |
| 53 | +> "A server MAY reject a request that contains both Content-Length and Transfer-Encoding... **Regardless, the server MUST close the connection after responding to such a request.**" — RFC 9112 §6.1 |
| 54 | +
|
| 55 | +The only safe outcomes are rejection (400) or closing the connection. Any other behavior risks desynchronization. |
| 56 | + |
| 57 | +## Why it matters |
| 58 | + |
| 59 | +This test detects **actual request smuggling**, not just RFC non-compliance. If the poison byte `X` merges with the follow-up GET, the server's request boundary parsing is broken. In a real proxy chain, an attacker could replace `X` with a complete smuggled request. |
| 60 | + |
| 61 | +## Verdicts |
| 62 | + |
| 63 | +- **Pass** — Server returns `400` (rejected outright), OR closes the connection (step 2 never executes) |
| 64 | +- **Fail** — Step 2 executes and returns `400` (desync confirmed — poison byte merged with GET) |
| 65 | +- **Fail** — Step 2 executes and returns `2xx` (MUST-close violated, connection stayed open) |
| 66 | + |
| 67 | +## Sources |
| 68 | + |
| 69 | +- [RFC 9112 §6.1](https://www.rfc-editor.org/rfc/rfc9112#section-6.1) |
| 70 | +- [RFC 9112 §11.2](https://www.rfc-editor.org/rfc/rfc9112#section-11.2) |
0 commit comments