Tornado vulnerable to HTTP request smuggling via improper parsing of `Content-Length` fields and chunk lengths
Moderate severity
GitHub Reviewed
Published
Aug 12, 2023
in
tornadoweb/tornado
•
Updated Sep 7, 2023
Description
Published to the GitHub Advisory Database
Aug 14, 2023
Reviewed
Aug 14, 2023
Last updated
Sep 7, 2023
Summary
Tornado interprets
-
,+
, and_
in chunk length andContent-Length
values, which are not allowed by the HTTP RFCs. This can result in request smuggling when Tornado is deployed behind certain proxies that interpret those non-standard characters differently. This is known to apply to older versions of haproxy, although the current release is not affected.Details
Tornado uses the
int
constructor to parse the values ofContent-Length
headers and chunk lengths in the following locations:tornado/http1connection.py:445
tornado/http1connection.py:621
tornado/http1connection.py:671
Because
int("0_0") == int("+0") == int("-0") == int("0")
, using theint
constructor to parse and validate strings that should contain only ASCII digits is not a good strategy.References