---
id: "CVE-2026-115877"
kind: "vulnerability"
aliases: ["CVE-2026-115877", "GHSA-q7qq-6mhp-9rc4"]
title: "Twisted: HTTP Request Smuggling in twisted.web via a Bare CR or LF in a Header Value"
severity: "medium"
cvss: 5.4
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "Twisted", "fixed": ["26.10.0rc1"], "affected": "<= 26.4.0", "ecosystem": "pypi"}]
ecosystems: ["pypi"]
tags: ["cwe-444", "package", "python", "reverse-proxy", "self-hosted", "twisted"]
not_affected_if: ["managed-hosting", "no-front-end-proxy", "not-using-twisted-web"]
published_at: "2026-10-23T20:44:43+00:00"
first_seen_at: "2026-10-23T20:45:22+00:00"
updated_at: "2026-10-23T20:46:23+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-q7qq-6mhp-9rc4", "first_seen_at": "2026-10-23T20:45:22+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-115877", "first_seen_at": "2026-10-23T21:57:34+00:00"}]
---

# Twisted: HTTP Request Smuggling in twisted.web via a Bare CR or LF in a Header Value

Twisted's HTTP server accepts a bare CR or LF inside a header value, so a header line can hide a following header and request framing can be made to disagree with a front-end proxy. An attacker can smuggle a request past a proxy's access controls, poison a shared connection, or poison a cache, but gets no code execution.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:Twisted affected <= 26.4.0 fixed 26.10.0rc1

## How to check

Check the installed Twisted version with: python -c "import twisted; print(twisted.__version__)"
Exposed if the version is 26.4.0 or earlier and Twisted web serves HTTP behind a front-end proxy or load balancer.

## Fix

Upgrade Twisted to 26.10.0rc1 or later.

## Timeline

- 2026-10-23T20:45:22+00:00 ghsa https://github.com/advisories/GHSA-q7qq-6mhp-9rc4
- 2026-10-23T21:57:34+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-115877

## From the sources

## 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:

```python
# 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.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
