Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. tornado
  4. ›
  5. GMS-2023-1908

GMS-2023-1908: Tornado vulnerable to HTTP request smuggling via improper parsing of `Content-Length` fields and chunk lengths

August 14, 2023

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:

<code>tornado/http1connection.py:445</code>

      self._expected_content_remaining = int(headers["Content-Length"])

<code>tornado/http1connection.py:621</code>

        content_length = int(headers["Content-Length"]) # type: Optional[int]

<code>tornado/http1connection.py:671</code>

      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.

References

  • github.com/advisories/GHSA-qppv-j76h-2rpx
  • github.com/tornadoweb/tornado/commit/b7a5dd29bb02950303ae96055082c12a1ea0a4fe
  • github.com/tornadoweb/tornado/security/advisories/GHSA-qppv-j76h-2rpx

Code Behaviors & Features

Detect and mitigate GMS-2023-1908 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 6.3.3

Fixed versions

  • 6.3.3

Solution

Upgrade to version 6.3.3 or above.

Source file

pypi/tornado/GMS-2023-1908.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:09 +0000.