# HTTP Request Smuggling due to ignoring chunk extensions

llhttp ignores chunk-extension bytes and accepts LF, so a crafted chunked body desyncs Node behind ATS, letting attackers smuggle requests past proxy ACLs to reach /admin.

- Payout: $250
- Severity: medium
- Program: Node.js
- Found by: mkg
- Disclosed: 2021-11-02
- CVE: CVE-2021-22960
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/1238099
- Library page: https://bugbountylibrary.com/r/h1%3A1238099
- Tags: area:oss domain:oss impact:internal-access kind:bounty platform:hackerone sev:medium tech:nodejs technique:parser-differential technique:source-review vuln:request-smuggling

**Target:** Node.js http module (llhttp chunked parser) behind Apache Traffic Server 9.0.0 proxy
**Root cause:** llhttp skips all bytes until CR when parsing chunk extensions, accepting any byte including LF, while ATS terminates the chunk-size line at the first LF without requiring a preceding CR, producing a parser differential.
**Steps:**
1. Set up Node 16.3.0 behind ATS 9.0.0 via docker-compose; confirm ATS reroutes /admin to /forbidden.
2. Craft chunked request where chunk size line is `2 \nxx` (LF inside chunk extension) followed by `4c` and a smuggled `GET /admin` request.
3. Send payload via `python3 payload.py | nc localhost 8080`.
4. Observe `/admin was reached!` in Node logs, confirming the smuggled request bypassed ATS ACL.
**How found:** Read llhttp source (http.ts lines 736-739) and noticed it ignores all bytes until CR in chunk extensions rather than validating against the RFC 7230 ABNF; hypothesized LF could be injected, then compared against ATS's chunk parsing to find the differential.
**Exploitation:** Attacker sends a single chunked request to the ATS front-end; ATS parses the chunk extension up to the LF and sees one request to /, while Node's llhttp treats the LF as part of the extension and parses the trailing bytes as a second request to /admin, which ATS would normally block. Response cannot be read due to an ATS connection-hang bug, but full control over smuggled headers/body is achieved.
**Insight:** When auditing a parser, check whether it validates the full ABNF of a field or just scans for a terminator; any byte accepted beyond the spec (especially LF/CR) is a desync candidate against a proxy that parses the same field differently.

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

**Smuggling payload with LF in chunk extension**

```
GET / HTTP/1.1
Host: localhost:8080
Transfer-Encoding: chunked

2 \nxx
4c
0

GET /admin HTTP/1.1
Host: localhost:8080
Transfer-Encoding: chunked

0
```

**Command sending payload through nc**

```
python3 payload.py | nc localhost 8080
```

