NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · PyPI

CVE-2026-115877: Twisted: HTTP Request Smuggling in twisted.web via a Bare CR or LF in a Header Value

mediumCVSS 3.1 5.4GHSA-q7qq-6mhp-9rc4

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 Twisted

Twisted

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 False

The 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

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 entries