CVE-2026-115877: Twisted: HTTP Request Smuggling in twisted.web via a Bare CR or LF in a Header Value
Twisted's HTTP server (twisted.web) accepts a bare CR or LF inside a header value. That lets an attacker hide a second header, such as Content-Length, from Twisted's parser and smuggle a request past a front-end proxy that frames the request differently. Twisted 26.4.0 and earlier are affected. The fix is in 26.10.0rc1.
Published Oct 23, 2026 · Analysis Nov 2, 2026
What an attacker can do
HTTPChannel.headerReceived rejects a NUL byte in a header value but not a bare CR or LF. RFC 9110 section 5.5 requires a recipient to reject all three. The channel splits lines only on CRLF, so Foo: x\nContent-Length: 39 arrives as one line. The name is Foo and the value holds the LF and the second header. Twisted never sees a Content-Length, installs no body decoder, and treats the bytes after the headers as the next request.
The flaw only matters behind a front-end that treats a bare LF as a line terminator. That proxy sees a Content-Length and forwards a body, while Twisted sees two requests. The attacker can then bypass front-end access controls, for example reaching /admin through a visible POST /public. The extra response can also poison the shared connection so a later user gets the attacker's response, or poison a cache. The advisory says there is no code execution. Without such a proxy, Twisted is the strict endpoint and the issue is not reachable.
Who is affected
Twisted 26.4.0 and earlier, in twisted.web.http.HTTPChannel. The practical risk is a deployment where a reverse proxy, load balancer or cache sits in front of a Twisted web server and accepts bare LF line endings. Check your version:
pip show TwistedTwisted
- Ecosystem
- PyPI
- Affected
- <= 26.4.0
- Fixed in
- 26.10.0rc1
- Check
pip show Twisted
How to fix it
Upgrade to Twisted 26.10.0rc1, the patched version listed in the advisory:
pip install "Twisted==26.10.0rc1"The advisory lists no workaround. Until you upgrade, check whether your front-end proxy rejects bare CR and LF in header values, which closes the framing disagreement.
How to tell if you were hit
Look in front-end and Twisted access logs for requests whose header values contain a raw \n or \r, and for a single client request that produces two responses on one connection. A request logged as POST /public followed by an unexpected GET /admin entry in Twisted's log, with no matching entry at the proxy, is the signature. Test your own stack with the advisory's request: a bare LF before Content-Length in a custom header.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
An incomplete header-value validation (CWE-444) in the Twisted HTTP server lets a bare carriage return or line feed in a header value hide a following header from the parser. twisted.web.http.HTTPChannel.headerReceived rejects a NUL byte in a header value but not a bare CR or LF, even though RFC 9110 section 5.5 requires a recipient to reject all three. Because the channel splits requests only on CRLF, a value carrying a bare LF and a second header arrives as one line, so the second header is folded into the value and the request is framed with no body. A front-end that treats the bare LF as a line terminator frames the request differently, and the disagreement lets an attacker smuggle a request past it. This is an incomplete fix of the earlier Twisted request-smuggling advisories, which guarded the NUL sibling of this exact check.
Details
headerReceived splits a header line on the first colon, strips space and tab from the value, and validates it with a single test that rejects only NUL:
# twisted/web/http.py HTTPChannel.headerReceived
data = data.strip(b" \t")
if b"\x00" in data: # NUL rejected; a bare CR or LF is not
self._respondToBadRequestAndDisconnect()
return FalseThe channel delimiter is CRLF, so Foo: x\nContent-Length: 39 is one line: the split yields name Foo and value x\nContent-Length: 39, strip leaves the LF, and the NUL check passes. _maybeChooseTransferDecoder is then called with Foo, never sees a Content-Length, and installs no body decoder, so the request is framed with an empty body. The header name and request line already reject CR and LF, so the value is the only gap.
Affected product: Twisted, twisted.web.http.HTTPChannel Affected versions: 26.4.0 and earlier
PoC
Feed one connection a request whose header value carries a bare LF and a Content-Length, followed by a second request in the bytes after it: POST /public HTTP/1.1\r\nHost: v\r\nFoo: x\nContent-Length: 44\r\n\r\nGET /admin HTTP/1.1\r\nHost: internal\r\n\r\n. Twisted parses two requests and serves both, so the smuggled GET /admin returns the /admin response body even though the visible request was only POST /public. The bare CR variant behaves identically, and a NUL in the value is rejected, which isolates the missing CR and LF checks.
Behind a front-end that treats the bare LF as a line terminator, the front-end frames one POST /public and forwards a body while Twisted frames a second GET /admin; the extra response then poisons the shared connection, so a later victim receives the attacker's GET /admin response.
Impact
This is an HTTP request-smuggling exposure (CWE-444) from inconsistent interpretation of a request (CWE-436). Through a front-end that accepts a bare CR or LF as a line terminator, an attacker can smuggle a request the front-end never sees, bypassing front-end access controls, poisoning a shared connection so a later victim receives the attacker's response, and poisoning a cache. Twisted is the strict endpoint that frames the request without a body, so it is realized only behind such a proxy, and there is no code execution.
Credited to arkmarta.
Questions
- Can this be exploited against Twisted directly, without a proxy?
Not in a useful way. The advisory says the exposure is realized only behind a front-end that accepts a bare CR or LF as a line terminator. Twisted is the strict endpoint.
- Does CVE-2026-115877 allow code execution?
No. The advisory states there is no code execution. The impact is request smuggling: bypassing front-end access controls, connection poisoning and cache poisoning.
- Is this related to earlier Twisted smuggling advisories?
Yes. The advisory calls it an incomplete fix of earlier request-smuggling advisories, which guarded the NUL byte case in the same header check but not CR or LF.
References
Read for this analysis:
- https://github.com/twisted/twisted/security/advisories/GHSA-q7qq-6mhp-9rc4
- https://github.com/twisted/twisted/pull/12755
- https://github.com/twisted/twisted/commit/022b6f7feb5980166c71f54e2c0d8f4f21ff6e1a
- https://github.com/twisted/twisted/commit/1616f702d36eda8990a5a5b22ad70fab140a7eb1
- https://github.com/twisted/twisted/releases/tag/twisted-26.10.0rc1
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More PyPI vulnerabilities
All PyPI entriesGHSA-vpp8-g58w-m8mp
Twisted: Unauthenticated Remote Denial of Service in the Twisted HTTP/2 Server via Rapid Stream Reset
high7.5Oct 29, 2026CVE-2026-83813
Twisted: DNS Response Spoofing in twisted.names Due to Missing Source Address Validation
low3.1Oct 27, 2026CVE-2026-115774
Twisted: Denial of Service in the Twisted IMAP4 Server via a Negative Literal Size in SEARCH
medium4.9Oct 23, 2026CVE-2026-115775
Twisted: Unauthenticated Remote Denial of Service in the Twisted words domish XML Element Stream via an Unbounded Element Tree
high8.7Oct 23, 2026CVE-2026-115776
Twisted: Unauthenticated Remote Denial of Service in the Twisted IRC Server via an Unbounded Line Buffer
high7.5Oct 23, 2026CVE-2026-115778
Twisted: Unauthenticated Remote Denial of Service in the Twisted conch Telnet Transport via an Unbounded Subnegotiation Buffer
high7.5Oct 23, 2026
