Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1xcHB2LWo3NmgtMnJweM4AA1Sz
Tornado vulnerable to HTTP request smuggling via improper parsing of `Content-Length` fields and chunk lengths
Summary
Tornado interprets -
, +
, and _
in chunk length and Content-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 of Content-Length
headers and chunk lengths in the following locations:
tornado/http1connection.py:445
self._expected_content_remaining = int(headers["Content-Length"])
tornado/http1connection.py:621
content_length = int(headers["Content-Length"]) # type: Optional[int]
tornado/http1connection.py:671
chunk_len = int(chunk_len_str.strip(), 16)
Because int("0_0") == int("+0") == int("-0") == int("0")
, using the int
constructor to parse and validate strings that should contain only ASCII digits is not a good strategy.
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1xcHB2LWo3NmgtMnJweM4AA1Sz
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 9 months ago
Updated: 8 months ago
Identifiers: GHSA-qppv-j76h-2rpx
References:
- https://github.com/tornadoweb/tornado/security/advisories/GHSA-qppv-j76h-2rpx
- https://github.com/tornadoweb/tornado/commit/b7a5dd29bb02950303ae96055082c12a1ea0a4fe
- https://github.com/advisories/GHSA-qppv-j76h-2rpx
Blast Radius: 0.0
Affected Packages
pypi:tornado
Dependent packages: 715Dependent repositories: 113,286
Downloads: 38,876,827 last month
Affected Version Ranges: < 6.3.3
Fixed in: 6.3.3
All affected versions: 1.1.1, 1.2.1, 2.1.1, 2.2.1, 2.4.1, 3.0.1, 3.0.2, 3.1.1, 3.2.1, 3.2.2, 4.0.1, 4.0.2, 4.2.1, 4.4.1, 4.4.2, 4.4.3, 4.5.1, 4.5.2, 4.5.3, 5.0.1, 5.0.2, 5.1.1, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.3.1, 6.3.2
All unaffected versions: 6.3.3