Advisory

GHSA-qppv-j76h-2rpx

Also known as: CVE-2023-54397

Summary

Tornado vulnerable to HTTP request smuggling via improper parsing of Content-Length fields and chunk lengths

Details

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.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2023-08-14 21:34 UTC
Modified
2026-09-16 03:56 UTC

Affected packages and fixes

tornado

PyPI · All systems

Affected

  • introduced 0, fixed 6.3.3 (ecosystem)

Fixed versions

6.3.3

Fix

  • Fixed version 6.3.3
    pip install --upgrade tornado==6.3.3

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences