GHSA-qppv-j76h-2rpx: Tornado Tornado Vulnerable To HTTP Request Vulnerability

MODERATE
CWE-444
Published
Advisory Summary

GHSA-qppv-j76h-2rpx is a MODERATE tornado vulnerable to http request vulnerability (CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')) affecting Tornado libraries in the PyPI ecosystem. The issue involves tornado vulnerable to http request smuggling via improper parsing of `content-length` fields and chunk lengths. Remediation is available by upgrading affected packages to version 6.3.3.

GHSA-qppv-j76h-2rpx at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qppv-j76h-2rpx
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
Affected Product Tornado
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-qppv-j76h-2rpx

To remediate this vulnerability, upgrade all affected Tornado dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

tornado fixed: 6.3.3
pip install tornado>=6.3.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show tornado

How to Check if You Are Affected

To determine whether your Python environment is affected by GHSA-qppv-j76h-2rpx, inspect your installed packages using pip:

pip show tornado

Analyze the terminal output to locate any version of Tornado in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.3.3), your application is affected.

Note: The pip show tornado command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling'), where the product acts as an intermediary http agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed http requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination. In Tornado, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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` ```python3 self._expected_content_remaining = int(headers["Content-Length"]) ``` ### `tornado/http1connection.py:621` ```python3 content_length = int(headers["Content-Length"]) # type: Optional[int] ``` ### `tornado/http1connection.py:671` ```python3 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.

GHSA-qppv-j76h-2rpx Affected Tornado Versions

1 component(s)
Fixed Versions:
6.3.3
Product / Package Ecosystem Affected Versions Fixed Version
tornado
PyPI
< 6.3.3
6.3.3

References

Frequently Asked Questions

What is GHSA-qppv-j76h-2rpx?
GHSA-qppv-j76h-2rpx is a security vulnerability in Tornado involving Tornado vulnerable to HTTP request smuggling via improper parsing of `Content-Length` fields and chunk lengths under CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling').
Which Tornado versions are affected?
Affected versions include releases prior to 6.3.3 across affected packages: tornado.
What version fixes GHSA-qppv-j76h-2rpx?
Upgrading to 6.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is tornado affected?
Yes, tornado is affected in releases prior to 6.3.3. Upgrade your dependency to 6.3.3 or later.
What CWE is associated with GHSA-qppv-j76h-2rpx?
GHSA-qppv-j76h-2rpx is classified under CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') (The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.).
How can I check PyPI dependencies for GHSA-qppv-j76h-2rpx?
Run the dependency tree command: 'pip show tornado'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qppv-j76h-2rpx",
  "modified" : "2023-08-14T21:34:17Z",
  "published" : "2023-08-14T21:34:17Z",
  "aliases" : [ ],
  "summary" : "Tornado vulnerable to HTTP request smuggling via improper parsing of `Content-Length` fields and chunk lengths",
  "details" : "## Summary\nTornado 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.\n\n## Details\nTornado uses the `int` constructor to parse the values of `Content-Length` headers and chunk lengths in the following locations:\n### `tornado/http1connection.py:445`\n```python3\n            self._expected_content_remaining = int(headers[\"Content-Length\"])\n```\n### `tornado/http1connection.py:621`\n```python3\n                content_length = int(headers[\"Content-Length\"])  # type: Optional[int]\n```\n### `tornado/http1connection.py:671`\n```python3\n            chunk_len = int(chunk_len_str.strip(), 16)\n```\nBecause `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. \n\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "tornado"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tornadoweb/tornado/security/advisories/GHSA-qppv-j76h-2rpx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tornadoweb/tornado/commit/b7a5dd29bb02950303ae96055082c12a1ea0a4fe"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tornadoweb/tornado"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-444" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-14T21:34:17Z",
    "nvd_published_at" : null
  }
}