CVE-2023-46137: Twisted Twisted.web Has Disordered HTTP Pipeline Vulnerability

MODERATE
Advisory Identifier: GHSA-xc8x-vp79-p3wm
CVSS 5.3
CWE-444
Published
Advisory Summary

CVE-2023-46137 is a MODERATE (CVSS 5.3) twisted.web has disordered http pipeline vulnerability (CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')) affecting Twisted libraries in the PyPI ecosystem. The issue involves twisted.web has disordered http pipeline response. Remediation is available by upgrading affected packages to version 23.10.0rc1.

CVE-2023-46137 at a Glance

CVE Identifier CVE-2023-46137
GHSA Identifier GHSA-xc8x-vp79-p3wm
Severity MODERATE
CVSS v3.1 Base Score 5.3
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: 5.3

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

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

How to Fix CVE-2023-46137

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: 23.10.0rc1
pip install Twisted>=23.10.0rc1
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-2023-46137, 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 23.10.0rc1), 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

Twisted is an event-based framework for internet applications. Prior to version 23.10.0rc1, when sending multiple HTTP requests in one TCP packet, twisted.web will process the requests asynchronously without guaranteeing the response order. If one of the endpoints is controlled by an attacker, the attacker can delay the response on purpose to manipulate the response of the second request when a victim launched two requests using HTTP pipeline. Version 23.10.0rc1 contains a patch for this issue. ### Details There's an example faulty program: ```python from twisted.internet import reactor, endpoints from twisted.web import server from twisted.web.proxy import ReverseProxyResource from twisted.web.resource import Resource class Second(Resource): isLeaf = True def render_GET(self, request): return b'SECOND\n' class First(Resource): isLeaf = True def render_GET(self, request): def send_response(): request.write(b'FIRST DELAYED\n') request.finish() reactor.callLater(0.5, send_response) return server.NOT_DONE_YET root = Resource() root.putChild(b'second', Second()) root.putChild(b'first', First()) endpoint = endpoints.TCP4ServerEndpoint(reactor, 8080) endpoint.listen(server.Site(root)) reactor.run() ``` When two requests for `/first` and `/second` are sent in the same order, the second request will be responded to first. ```shell echo -en "GET /first HTTP/1.1\r\nHost: a\r\n\r\nGET /second HTTP/1.1\r\nHost: a\r\n\r\n" | nc localhost 8080 ```

CVE-2023-46137 Affected Twisted Versions

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

References

Frequently Asked Questions

What is CVE-2023-46137?
CVE-2023-46137 is a security vulnerability in Twisted involving twisted.web has disordered HTTP pipeline response under CWE-444: Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling').
Which Twisted versions are affected?
Affected versions include releases prior to 23.10.0rc1 across affected packages: Twisted.
What version fixes CVE-2023-46137?
Upgrading to 23.10.0rc1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Twisted affected?
Yes, Twisted is affected in releases prior to 23.10.0rc1. Upgrade your dependency to 23.10.0rc1 or later.
What is the CVSS score of CVE-2023-46137?
CVE-2023-46137 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2023-46137?
CVE-2023-46137 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-2023-46137?
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-xc8x-vp79-p3wm",
  "modified" : "2025-11-04T16:46:32Z",
  "published" : "2023-10-25T21:15:13Z",
  "aliases" : [ "CVE-2023-46137" ],
  "summary" : "twisted.web has disordered HTTP pipeline response",
  "details" : "Twisted is an event-based framework for internet applications. Prior to version 23.10.0rc1, when sending multiple HTTP requests in one TCP packet, twisted.web will process the requests asynchronously without guaranteeing the response order. If one of the endpoints is controlled by an attacker, the attacker can delay the response on purpose to manipulate the response of the second request when a victim launched two requests using HTTP pipeline. Version 23.10.0rc1 contains a patch for this issue.\n\n### Details\nThere's an example faulty program:\n```python\nfrom twisted.internet import reactor, endpoints\nfrom twisted.web import server\nfrom twisted.web.proxy import ReverseProxyResource\nfrom twisted.web.resource import Resource\n\nclass Second(Resource):\n    isLeaf = True\n    def render_GET(self, request):\n        return b'SECOND\\n'\n\nclass First(Resource):\n    isLeaf = True\n    def render_GET(self, request):\n        def send_response():\n            request.write(b'FIRST DELAYED\\n')\n            request.finish()\n        reactor.callLater(0.5, send_response)\n        return server.NOT_DONE_YET\n\nroot = Resource()\n\nroot.putChild(b'second', Second())\nroot.putChild(b'first', First())\n\nendpoint = endpoints.TCP4ServerEndpoint(reactor, 8080)\nendpoint.listen(server.Site(root))\nreactor.run()\n```\n\nWhen two requests for `/first` and `/second` are sent in the same order, the second request will be responded to first.\n```shell\necho -en \"GET /first HTTP/1.1\\r\\nHost: a\\r\\n\\r\\nGET /second HTTP/1.1\\r\\nHost: a\\r\\n\\r\\n\" | nc localhost 8080\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Twisted"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "23.10.0rc1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/twisted/twisted/security/advisories/GHSA-xc8x-vp79-p3wm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-46137"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/twisted/PYSEC-2023-224.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/twisted/twisted"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/11/msg00028.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-444" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-25T21:15:13Z",
    "nvd_published_at" : "2023-10-25T21:15:10Z"
  }
}