CVE-2022-24801: Twisted Inconsistent Interpretation Of HTTP Requests Vulnerability

CRITICAL
Advisory Identifier: GHSA-c2jg-hw38-jrqq
CVSS 8.1
CWE-444
Published
Advisory Summary

CVE-2022-24801 is a CRITICAL (CVSS 8.1) inconsistent interpretation of http requests vulnerability (CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')) affecting Twisted libraries in the PyPI ecosystem. The issue involves inconsistent interpretation of http requests in twisted.web. Remediation is available by upgrading affected packages to version 22.4.0.

CVE-2022-24801 at a Glance

CVE Identifier CVE-2022-24801
GHSA Identifier GHSA-c2jg-hw38-jrqq
Severity CRITICAL
CVSS v3.1 Base Score 8.1
CWE Classification CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')
Affected Product Twisted
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-24801

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

Twisted fixed: 22.4.0
pip install Twisted>=22.4.0
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 Twisted

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-24801, inspect your installed packages using pip:

pip show Twisted

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

Note: The pip show Twisted 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 Twisted, 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

The Twisted Web HTTP 1.1 server, located in the `twisted.web.http` module, parsed several HTTP request constructs more leniently than permitted by RFC 7230: 1. The Content-Length header value could have a `+` or `-` prefix. 2. Illegal characters were permitted in chunked extensions, such as the LF (`\n`) character. 3. Chunk lengths, which are expressed in hexadecimal format, could have a prefix of `0x`. 4. HTTP headers were stripped of all leading and trailing ASCII whitespace, rather than only space and HTAB (`\t`). This non-conformant parsing can lead to desync if requests pass through multiple HTTP parsers, potentially resulting in HTTP request smuggling. ### Impact You may be affected if: 1. You use Twisted Web's HTTP 1.1 server and/or proxy 2. You also pass requests through a different HTTP server and/or proxy The specifics of the other HTTP parser matter. The original report notes that some versions of Apache Traffic Server and HAProxy have been vulnerable in the past. HTTP request smuggling may be a serious concern if you use a proxy to perform request validation or access control. The Twisted Web client is not affected. The HTTP 2.0 server uses a different parser, so it is not affected. ### Patches The issue has been addressed in Twisted 22.4.0rc1 and later. ### Workarounds Other than upgrading Twisted, you could: * Ensure any vulnerabilities in upstream proxies have been addressed, such as by upgrading them * Filter malformed requests by other means, such as configuration of an upstream proxy ### Credits This issue was initially reported by [Zhang Zeyu](https://github.com/zeyu2001).

CVE-2022-24801 Affected Twisted Versions

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

References

GitHub Advisory / Wiki ADVISORY
https://github.com/twisted/twisted/security/advisories/GHSA-c2jg-hw38-jrqq
NVD — CVE-2022-24801 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-24801
Security Fix Commit FIX COMMIT
https://github.com/twisted/twisted/commit/592217e951363d60e9cd99c5bbfd23d4615043ac
Twisted Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/twisted/PYSEC-2022-195.yaml
Twisted Source Repository REPOSITORY
https://github.com/twisted/twisted
Twisted Release RELEASE
https://github.com/twisted/twisted/releases/tag/twisted-22.4.0rc1
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2022/05/msg00003.html
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7U6KYDTOLPICAVSR34G2WRYLFBD2YW5K
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GLKHA6WREIVAMBQD7KKWYHPHGGNKMAG6
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7U6KYDTOLPICAVSR34G2WRYLFBD2YW5K
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GLKHA6WREIVAMBQD7KKWYHPHGGNKMAG6
Twisted Security Information SECURITY
https://www.oracle.com/security-alerts/cpujul2022.html

Frequently Asked Questions

What is CVE-2022-24801?
CVE-2022-24801 is a security vulnerability in Twisted involving Inconsistent Interpretation of HTTP Requests in twisted.web under CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling').
Which Twisted versions are affected?
Affected versions include releases prior to 22.4.0 across affected packages: Twisted.
What version fixes CVE-2022-24801?
Upgrading to 22.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Twisted affected?
Yes, Twisted is affected in releases prior to 22.4.0. Upgrade your dependency to 22.4.0 or later.
What is the CVSS score of CVE-2022-24801?
CVE-2022-24801 has a CVSS v3.1 base score of 8.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-24801?
CVE-2022-24801 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 CVE-2022-24801?
Run the dependency tree command: 'pip show Twisted'. 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-c2jg-hw38-jrqq",
  "modified" : "2024-11-25T18:33:24Z",
  "published" : "2022-04-04T21:29:41Z",
  "aliases" : [ "CVE-2022-24801" ],
  "summary" : "Inconsistent Interpretation of HTTP Requests in twisted.web",
  "details" : "The Twisted Web HTTP 1.1 server, located in the `twisted.web.http` module, parsed several HTTP request constructs more leniently than permitted by RFC 7230:\n\n1. The Content-Length header value could have a `+` or `-` prefix.\n2. Illegal characters were permitted in chunked extensions, such as the LF (`\\n`) character.\n3. Chunk lengths, which are expressed in hexadecimal format, could have a prefix of `0x`.\n4. HTTP headers were stripped of all leading and trailing ASCII whitespace, rather than only space and HTAB (`\\t`).\n\nThis non-conformant parsing can lead to desync if requests pass through multiple HTTP parsers, potentially resulting in HTTP request smuggling.\n\n### Impact\n\nYou may be affected if:\n\n1. You use Twisted Web's HTTP 1.1 server and/or proxy\n2. You also pass requests through a different HTTP server and/or proxy\n\nThe specifics of the other HTTP parser matter. The original report notes that some versions of Apache Traffic Server and HAProxy have been vulnerable in the past. HTTP request smuggling may be a serious concern if you use a proxy to perform request validation or access control.\n\nThe Twisted Web client is not affected. The HTTP 2.0 server uses a different parser, so it is not affected.\n\n### Patches\n\nThe issue has been addressed in Twisted 22.4.0rc1 and later.\n\n### Workarounds\n\nOther than upgrading Twisted, you could:\n\n* Ensure any vulnerabilities in upstream proxies have been addressed, such as by upgrading them\n* Filter malformed requests by other means, such as configuration of an upstream proxy\n\n### Credits\n\nThis issue was initially reported by [Zhang Zeyu](https://github.com/zeyu2001).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Twisted"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "22.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/twisted/twisted/security/advisories/GHSA-c2jg-hw38-jrqq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24801"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/twisted/twisted/commit/592217e951363d60e9cd99c5bbfd23d4615043ac"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/twisted/PYSEC-2022-195.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/twisted/twisted"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/twisted/twisted/releases/tag/twisted-22.4.0rc1"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2022/05/msg00003.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7U6KYDTOLPICAVSR34G2WRYLFBD2YW5K"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GLKHA6WREIVAMBQD7KKWYHPHGGNKMAG6"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/7U6KYDTOLPICAVSR34G2WRYLFBD2YW5K"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GLKHA6WREIVAMBQD7KKWYHPHGGNKMAG6"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/security-alerts/cpujul2022.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-444" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-04T21:29:41Z",
    "nvd_published_at" : "2022-04-04T18:15:00Z"
  }
}