python3-twisted: Security fixes
cover python3-twisted: Security fixes
Backport 5 python3-twisted security fixes to the python3-twisted 25.5.0 recipe on wrynose. The series adds the fixes as patches and updates the recipe to apply them.
The fixes for CVE-2026-115774 and CVE-2026-115776 are each carried in two patches. The CVE-2026-115877 fix is carried in three patches and CVE-2026-115778 in four patches. The CVE-2026-83813 fix is carried in four patches and one regression patch. The patches retain upstream references.
Yogita Urade (5):
python3-twisted: Fix CVE-2026-83813
python3-twisted: Fix CVE-2026-115877
python3-twisted: Fix CVE-2026-115774
python3-twisted: Fix CVE-2026-115776
python3-twisted: Fix CVE-2026-115778
.../python3-twisted/CVE-2026-115774_p1.patch | 55 ++++ .../python3-twisted/CVE-2026-115774_p2.patch | 26 ++ .../python3-twisted/CVE-2026-115776_p1.patch | 111 +++++++ .../python3-twisted/CVE-2026-115776_p2.patch | 79 +++++ .../python3-twisted/CVE-2026-115778_p1.patch | 105 +++++++ .../python3-twisted/CVE-2026-115778_p2.patch | 286 ++++++++++++++++++ .../python3-twisted/CVE-2026-115778_p3.patch | 108 +++++++ .../python3-twisted/CVE-2026-115778_p4.patch | 36 +++ .../python3-twisted/CVE-2026-115877_p1.patch | 71 +++++ .../python3-twisted/CVE-2026-115877_p2.patch | 30 ++ .../python3-twisted/CVE-2026-115877_p3.patch | 78 +++++ .../CVE-2026-83813-regression.patch | 62 ++++ .../python3-twisted/CVE-2026-83813_p1.patch | 62 ++++ .../python3-twisted/CVE-2026-83813_p2.patch | 36 +++ .../python3-twisted/CVE-2026-83813_p3.patch | 35 +++ .../python3-twisted/CVE-2026-83813_p4.patch | 28 ++ .../python/python3-twisted_25.5.0.bb | 16 + 17 files changed, 1224 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch
Signature · 1 line
2.53.0
PATCH 1/5 python3-twisted: Fix CVE-2026-83813
This series applies the upstream endpoint-validation fix in [1] to Twisted 25.5.0 and carries the related address-map cleanup as separate patches.
CVE-2026-83813_p2.patch adapts the timeout cleanup from [2] to the 25.5.0 DNSDatagramProtocol hook. CVE-2026-83813_p3.patch retains only the successful- response cleanup from [3], omitting its shared response-handler refactor, names/client.py changes, logger migration, and related typing changes. CVE-2026-83813_p4.patch applies [4]'s correction, making timeout cleanup tolerant if protocol shutdown has already removed the map entry. These changes are interrelated: p2 adds timeout cleanup, p3 clears successful queries, and p4 makes the timeout cleanup safe after shutdown.
The upstream regression test in [5] targets a newer DatagramProtocolTests harness and does not apply directly to Twisted 25.5.0. The series carries an adapted version in CVE-2026-83813-regression.patch after p1 through p4. It checks wrong response IDs, hosts, and ports before accepting the expected endpoint, and verifies address-map cleanup after success and timeout.
Backport the DNS response-origin validation fix from Twisted PR #12700
[7] to Twisted 25.5.0. The backport selects the five upstream commits needed for the fix and its regression coverage, retaining only relevant hunks where an upstream commit also contains unrelated changes.
[1] https://github.com/twisted/twisted/commit/b53e1c3477c209b5609a1c74cf9e48373b5879ac
[2] https://github.com/twisted/twisted/commit/fce7991ca2a2c17f3e8f86fb18c2aa17eed2c7e1
[3] https://github.com/twisted/twisted/commit/83f2165703766ba1fd7dc40638ac462bae6924d1
[4] https://github.com/twisted/twisted/commit/f6ee6cf35053382a356ec6f0fff490734737e06c
[5] https://github.com/twisted/twisted/commit/80d4907046def3e839b30dfff860564cb0311082
[6] https://nvd.nist.gov/vuln/detail/cve-2026-83813
[7] https://github.com/twisted/twisted/pull/12700
--- .../CVE-2026-83813-regression.patch | 62 +++++++++++++++++++ .../python3-twisted/CVE-2026-83813_p1.patch | 62 +++++++++++++++++++ .../python3-twisted/CVE-2026-83813_p2.patch | 36 +++++++++++ .../python3-twisted/CVE-2026-83813_p3.patch | 35 +++++++++++ .../python3-twisted/CVE-2026-83813_p4.patch | 28 +++++++++ .../python/python3-twisted_25.5.0.bb | 5 ++ 6 files changed, 228 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch new file +62 -0
@@ -0,0 +1,62 @@ +From 80d4907046def3e839b30dfff860564cb0311082 Mon Sep 17 00:00:00 2001 +From: Glyph <[email protected]> +Date: Wed, 15 Jul 2026 21:06:23 -0700 +Subject: [PATCH] failing test for the problem + +CVE: CVE-2026-83813 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/80d4907046def3e839b30dfff860564cb0311082] + +Backport Changes: +- Adapted the upstream regression test to the Twisted 25.5.0 test harness. + Kept the response-ID, host, and port rejection checks; added downstream + assertions for address-map cleanup after success and timeout. Omitted unrelated + test-harness modernization. + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/names/test/test_dns.py | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/src/twisted/names/test/test_dns.py b/src/twisted/names/test/test_dns.py +index 3b8f6e1..66bbbac 100644 +--- a/src/twisted/names/test/test_dns.py ++++ b/src/twisted/names/test/test_dns.py +@@ -1304,6 +1304,28 @@ class DatagramProtocolTests(unittest.TestCase): + self.proto.datagramReceived(m.toStr(), ("127.0.0.1", 21345)) + return d + ++ def test_discardedResponses(self): ++ """ ++ Responses to queries sent with the wrong host address or port are ++ ignored until a response from the queried endpoint arrives. ++ """ ++ d = self.proto.query(("127.0.0.1", 21345), [dns.Query(b"foo")], id=4321) ++ m = dns.Message() ++ m.id = 1234 ++ m.answers = [dns.RRHeader(payload=dns.Record_A(address="1.2.3.4"))] ++ self.proto.datagramReceived(m.toStr(), ("127.0.0.1", 21345)) ++ self.assertNoResult(d) ++ m.id = 4321 ++ self.proto.datagramReceived(m.toStr(), ("127.0.0.2", 21345)) ++ self.assertNoResult(d) ++ self.proto.datagramReceived(m.toStr(), ("127.0.0.1", 21346)) ++ self.assertNoResult(d) ++ self.proto.datagramReceived(m.toStr(), ("127.0.0.1", 21345)) ++ self.assertEqual( ++ self.successResultOf(d).answers[0].payload.dottedQuad(), "1.2.3.4" ++ ) ++ self.assertEqual(self.proto._addressValidation, {}) ++ + def test_queryTimeout(self): + """ + Test that query timeouts after some seconds. +@@ -1312,6 +1334,7 @@ class DatagramProtocolTests(unittest.TestCase): + self.assertEqual(len(self.proto.liveMessages), 1) + self.clock.advance(10) + self.assertFailure(d, dns.DNSQueryTimeoutError) ++ self.assertEqual(self.proto._addressValidation, {}) + self.assertEqual(len(self.proto.liveMessages), 0) + return d + +-- +2.35.6
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch new file +62 -0
62 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch new file +36 -0
@@ -0,0 +1,36 @@ +From fce7991ca2a2c17f3e8f86fb18c2aa17eed2c7e1 Mon Sep 17 00:00:00 2001 +From: Glyph <[email protected]> +Date: Thu, 16 Jul 2026 09:14:36 -0700 +Subject: [PATCH] add documentation to these variables + +CVE: CVE-2026-83813 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/fce7991ca2a2c17f3e8f86fb18c2aa17eed2c7e1] + +Backport Changes: +- Port the address-validation timeout cleanup into the 25.5.0 + DNSDatagramProtocol._clearFailed hook. Variable documentation and typing + changes from upstream are omitted. Successful-response cleanup is carried + separately, followed by the f6ee6cf3 timeout-cleanup correction. + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/names/dns.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/twisted/names/dns.py b/src/twisted/names/dns.py +index 11eb805..7c29ed0 100644 +--- a/src/twisted/names/dns.py ++++ b/src/twisted/names/dns.py +@@ -3246,6 +3246,10 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + def startListening(self): + self._reactor.listenUDP(0, self, maxPacketSize=512) + ++ def _clearFailed(self, deferred, id): ++ del self._addressValidation[id] ++ super()._clearFailed(deferred, id) ++ + def datagramReceived(self, data, addr): + """ + Read a datagram, extract the message in it and trigger the associated +-- +2.35.6
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 83f2165703766ba1fd7dc40638ac462bae6924d1 Mon Sep 17 00:00:00 2001 +From: Glyph <[email protected]> +Date: Fri, 17 Jul 2026 22:27:03 -0700 +Subject: [PATCH] refactor duplicate response handling + +more type annotations to make sure we don't make any mistakes + +CVE: CVE-2026-83813 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/83f2165703766ba1fd7dc40638ac462bae6924d1] + +Backport Changes: +- Keep only successful-response address-map cleanup in the existing + Twisted 25.5.0 UDP handler. Omit the shared response-handler refactor, + names/client.py changes, logger migration, and related typing changes. + Timeout cleanup is carried separately by p2 and corrected by p4. + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/names/dns.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/twisted/names/dns.py b/src/twisted/names/dns.py +index 7c29ed0..9b4e8e0 100644 +--- a/src/twisted/names/dns.py ++++ b/src/twisted/names/dns.py +@@ -3277,6 +3277,7 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + return + d, canceller = self.liveMessages[m.id] + del self.liveMessages[m.id] ++ self._addressValidation.pop(m.id) + canceller.cancel() + # XXX we shouldn't need this hack of catching exception on callback() + try: +-- +2.35.6
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch new file +28 -0
@@ -0,0 +1,28 @@ +From f6ee6cf35053382a356ec6f0fff490734737e06c Mon Sep 17 00:00:00 2001 +From: Glyph <[email protected]> +Date: Sat, 18 Jul 2026 08:20:07 -0700 +Subject: [PATCH] quash errors in validation per review + +CVE: CVE-2026-83813 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/f6ee6cf35053382a356ec6f0fff490734737e06c] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/names/dns.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/twisted/names/dns.py b/src/twisted/names/dns.py +index 9b4e8e0..ea59a70 100644 +--- a/src/twisted/names/dns.py ++++ b/src/twisted/names/dns.py +@@ -3247,7 +3247,7 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + self._reactor.listenUDP(0, self, maxPacketSize=512) + + def _clearFailed(self, deferred, id): +- del self._addressValidation[id] ++ self._addressValidation.pop(id, None) + super()._clearFailed(deferred, id) + + def datagramReceived(self, data, addr): +-- +2.35.6
meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +5 -0
@@ -12,6 +12,11 @@ SRC_URI += "file://CVE-2026-42304_p1.patch \ file://CVE-2026-42304_p4.patch \ file://CVE-2026-42304_p5.patch \ file://CVE-2026-42304_p6.patch \ + file://CVE-2026-83813_p1.patch \ + file://CVE-2026-83813_p2.patch \ + file://CVE-2026-83813_p3.patch \ + file://CVE-2026-83813_p4.patch \ + file://CVE-2026-83813-regression.patch \ " SRC_URI[sha256sum] = "1deb272358cb6be1e3e8fc6f9c8b36f78eb0fa7c2233d2dbe11ec6fee04ea316"
Signature · 1 line
2.53.0
PATCH 2/5 python3-twisted: Fix CVE-2026-115877
In reply to Yogita UradeThis patch applies the upstream fix as referenced in [5], using the commit shown in [1], [2] and [3].
[1] https://github.com/twisted/twisted/commit/1616f702d36eda8990a5a5b22ad70fab140a7eb1
[2] https://github.com/twisted/twisted/commit/022b6f7feb5980166c71f54e2c0d8f4f21ff6e1a
[3] https://github.com/twisted/twisted/commit/9b826a307b1f5d16df84bce2bdb2a3c70dabf06c
[4] https://nvd.nist.gov/vuln/detail/CVE-2026-115877
[5] https://github.com/twisted/twisted/pull/12755
[6] https://github.com/twisted/twisted/security/advisories/GHSA-q7qq-6mhp-9rc4
--- .../python3-twisted/CVE-2026-115877_p1.patch | 71 +++++++++++++++++ .../python3-twisted/CVE-2026-115877_p2.patch | 30 +++++++ .../python3-twisted/CVE-2026-115877_p3.patch | 78 +++++++++++++++++++ .../python/python3-twisted_25.5.0.bb | 3 + 4 files changed, 182 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch new file +71 -0
@@ -0,0 +1,71 @@ +From 1616f702d36eda8990a5a5b22ad70fab140a7eb1 Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Fri, 31 Jul 2026 14:04:59 +0200 +Subject: [PATCH] Reject a bare CR or LF in an HTTP header value (#12754) + +CVE: CVE-2026-115877 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/1616f702d36eda8990a5a5b22ad70fab140a7eb1] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/web/http.py | 4 +++- + src/twisted/web/newsfragments/12754.bugfix | 1 + + src/twisted/web/test/test_http.py | 22 ++++++++++++++++++++++ + 3 files changed, 26 insertions(+), 1 deletion(-) + create mode 100644 src/twisted/web/newsfragments/12754.bugfix + +diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py +index c2894fbd2..2ac611105 100644 +--- a/src/twisted/web/http.py ++++ b/src/twisted/web/http.py +@@ -2509,7 +2509,9 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin): + return False + + data = data.strip(b" \t") +- if b"\x00" in data: ++ # Reject NUL, CR, and LF in a header value (RFC 9110 section 5.5); a ++ # bare CR or LF would let a lenient proxy smuggle a following header. ++ if b"\x00" in data or b"\r" in data or b"\n" in data: + self._respondToBadRequestAndDisconnect() + return False + +diff --git a/src/twisted/web/newsfragments/12754.bugfix b/src/twisted/web/newsfragments/12754.bugfix +new file mode 100644 +index 000000000..9d42c4682 +--- /dev/null ++++ b/src/twisted/web/newsfragments/12754.bugfix +@@ -0,0 +1 @@ ++twisted.web.http.HTTPChannel.headerReceived now rejects a header value that contains a bare carriage return or line feed, closing a request-smuggling gap where such a value could hide a following header from the parser (RFC 9110 section 5.5). +diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py +index 3b4460c12..1c4bd8a21 100644 +--- a/src/twisted/web/test/test_http.py ++++ b/src/twisted/web/test/test_http.py +@@ -2209,6 +2209,28 @@ class ParsingTests(unittest.TestCase): + [b"GET / HTTP/1.1", b"Host: foo.example", header, b"", b""] + ) + ++ def test_invalidHeaderValueCRLF(self): ++ """ ++ A header value containing a bare CR or LF is rejected with a 400, as ++ required by RFC 9110 section 5.5; accepting it would let a following ++ header be hidden from the parser and enable request smuggling. The bytes ++ are fed directly because L{runRequest} normalises a bare LF to CRLF. ++ """ ++ for value in [ ++ b"a\nContent-Length: 5", # bare LF hiding a header ++ b"a\rContent-Length: 5", # bare CR hiding a header ++ b"a\nb", # bare LF ++ b"a\rb", # bare CR ++ ]: ++ channel = http.HTTPChannel() ++ transport = StringTransport() ++ channel.makeConnection(transport) ++ channel.dataReceived( ++ b"GET / HTTP/1.1\r\nHost: foo.example\r\nx-foo: " + value + b"\r\n\r\n" ++ ) ++ self.assertTrue(transport.disconnecting) ++ self.assertEqual(transport.value(), b"HTTP/1.1 400 Bad Request\r\n\r\n") ++ + def test_headerLimitPerRequest(self): + """ + C{HTTPChannel} enforces the limit of C{HTTPChannel.maxHeaders} per
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch new file +30 -0
@@ -0,0 +1,30 @@ +From 022b6f7feb5980166c71f54e2c0d8f4f21ff6e1a Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Fri, 31 Jul 2026 14:30:02 +0200 +Subject: [PATCH] web: check a header value for NUL CR and LF in one pass + +CVE: CVE-2026-115877 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/022b6f7feb5980166c71f54e2c0d8f4f21ff6e1a] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/web/http.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py +index 2ac611105..b6ee3e5a5 100644 +--- a/src/twisted/web/http.py ++++ b/src/twisted/web/http.py +@@ -2509,9 +2509,9 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin): + return False + + data = data.strip(b" \t") +- # Reject NUL, CR, and LF in a header value (RFC 9110 section 5.5); a +- # bare CR or LF would let a lenient proxy smuggle a following header. +- if b"\x00" in data or b"\r" in data or b"\n" in data: ++ # A header value must not contain NUL, CR, or LF (RFC 9110 section 5.5). ++ # A bare CR or LF here would let a lenient proxy smuggle a header. ++ if len(data.translate(None, b"\x00\r\n")) != len(data): + self._respondToBadRequestAndDisconnect() + return False +
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch new file +78 -0
78 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +3 -0
@@ -17,6 +17,9 @@ SRC_URI += "file://CVE-2026-42304_p1.patch \ file://CVE-2026-83813_p3.patch \ file://CVE-2026-83813_p4.patch \ file://CVE-2026-83813-regression.patch \ + file://CVE-2026-115877_p1.patch \ + file://CVE-2026-115877_p2.patch \ + file://CVE-2026-115877_p3.patch \ " SRC_URI[sha256sum] = "1deb272358cb6be1e3e8fc6f9c8b36f78eb0fa7c2233d2dbe11ec6fee04ea316"
Signature · 1 line
2.53.0
PATCH 3/5 python3-twisted: Fix CVE-2026-115774
In reply to Yogita UradeThis patch applies the upstream fix as referenced in [3], using the commit shown in [1] and [2].
[1] https://github.com/twisted/twisted/commit/3d125548bcbe955007cb97f480bb699a5e074741
[2] https://github.com/twisted/twisted/commit/a97aa5babb151b5d1aebf1c14596c786cd0bf105
[3] https://nvd.nist.gov/vuln/detail/CVE-2026-115774
[4] https://github.com/twisted/twisted/pull/12764
--- .../python3-twisted/CVE-2026-115774_p1.patch | 55 +++++++++++++++++++ .../python3-twisted/CVE-2026-115774_p2.patch | 26 +++++++++ .../python/python3-twisted_25.5.0.bb | 2 + 3 files changed, 83 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch new file +55 -0
@@ -0,0 +1,55 @@ +From 3d125548bcbe955007cb97f480bb699a5e074741 Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Sun, 2 Aug 2026 19:43:50 +0200 +Subject: [PATCH] mail: reject a negative IMAP literal size (Fixes #12763) + +CVE: CVE-2026-115774 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/3d125548bcbe955007cb97f480bb699a5e074741] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/mail/imap4.py | 2 ++ + src/twisted/mail/newsfragments/12763.bugfix | 1 + + src/twisted/mail/test/test_imap.py | 8 ++++++++ + 3 files changed, 11 insertions(+) + create mode 100644 src/twisted/mail/newsfragments/12763.bugfix + +diff --git a/src/twisted/mail/imap4.py b/src/twisted/mail/imap4.py +index f38d094f8..7aee83886 100644 +--- a/src/twisted/mail/imap4.py ++++ b/src/twisted/mail/imap4.py +@@ -4756,6 +4756,8 @@ def parseNestedParens(s, handleLiteral=1): + if end == -1: + raise ValueError("Malformed literal") + literalSize = int(s[i + 1 : end]) ++ if literalSize < 0: ++ raise ValueError("Illegal literal size") + contentStack[-1].append((s[end + 3 : end + 3 + literalSize],)) + i = end + 3 + literalSize + elif c == b"(" or c == b"[": +diff --git a/src/twisted/mail/newsfragments/12763.bugfix b/src/twisted/mail/newsfragments/12763.bugfix +new file mode 100644 +index 000000000..929a1b53a +--- /dev/null ++++ b/src/twisted/mail/newsfragments/12763.bugfix +@@ -0,0 +1 @@ ++twisted.mail.imap4.IMAP4Server now rejects a SEARCH command containing a literal with a negative octet count, so an authenticated client can no longer freeze the server with a crafted command. +diff --git a/src/twisted/mail/test/test_imap.py b/src/twisted/mail/test/test_imap.py +index d2c63eb69..43c1c03b8 100644 +--- a/src/twisted/mail/test/test_imap.py ++++ b/src/twisted/mail/test/test_imap.py +@@ -1324,6 +1324,14 @@ class IMAP4HelperTests(TestCase): + for case, expected in cases: + self.assertEqual(imap4.parseNestedParens(case), expected) + ++ def test_literalNegativeSize(self): ++ """ ++ A literal with a negative octet count is rejected with L{ValueError} ++ instead of driving the parser into a non-terminating loop. ++ """ ++ self.assertRaises(ValueError, imap4.parseNestedParens, b"{-1}", 1) ++ self.assertRaises(ValueError, imap4.parseNestedParens, b"foo {-100}bar", 1) ++ + def test_queryBuilder(self): + inputs = [ + imap4.Query(flagged=1),
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch new file +26 -0
@@ -0,0 +1,26 @@ +From a97aa5babb151b5d1aebf1c14596c786cd0bf105 Mon Sep 17 00:00:00 2001 +From: Glyph <[email protected]> +Date: Tue, 4 Aug 2026 15:57:56 -0700 +Subject: [PATCH] Update src/twisted/mail/test/test_imap.py + +CVE: CVE-2026-115774 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/a97aa5babb151b5d1aebf1c14596c786cd0bf105] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/mail/test/test_imap.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/twisted/mail/test/test_imap.py b/src/twisted/mail/test/test_imap.py +index 43c1c03b8..ae42caad9 100644 +--- a/src/twisted/mail/test/test_imap.py ++++ b/src/twisted/mail/test/test_imap.py +@@ -1324,7 +1324,7 @@ class IMAP4HelperTests(TestCase): + for case, expected in cases: + self.assertEqual(imap4.parseNestedParens(case), expected) + +- def test_literalNegativeSize(self): ++ def test_literalNegativeSize(self) -> None: + """ + A literal with a negative octet count is rejected with L{ValueError} + instead of driving the parser into a non-terminating loop.
meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +2 -0
@@ -20,6 +20,8 @@ SRC_URI += "file://CVE-2026-42304_p1.patch \ file://CVE-2026-115877_p1.patch \ file://CVE-2026-115877_p2.patch \ file://CVE-2026-115877_p3.patch \ + file://CVE-2026-115774_p1.patch \ + file://CVE-2026-115774_p2.patch \ " SRC_URI[sha256sum] = "1deb272358cb6be1e3e8fc6f9c8b36f78eb0fa7c2233d2dbe11ec6fee04ea316"
Signature · 1 line
2.53.0
PATCH 4/5 python3-twisted: Fix CVE-2026-115776
In reply to Yogita UradeThis patch applies the upstream fix as referenced in [3], using the commit shown in [1].
[1] https://github.com/twisted/twisted/commit/ac90fb7b0ab73688a581fcd9a7c0577ec8ca3059
[2] https://github.com/twisted/twisted/commit/01f8cff7753c1edac132380b2ea939fa6bdbab30
[3] https://nvd.nist.gov/vuln/detail/CVE-2026-115776
--- .../python3-twisted/CVE-2026-115776_p1.patch | 111 ++++++++++++++++++ .../python3-twisted/CVE-2026-115776_p2.patch | 79 +++++++++++++ .../python/python3-twisted_25.5.0.bb | 2 + 3 files changed, 192 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch new file +111 -0
@@ -0,0 +1,111 @@ +From ac90fb7b0ab73688a581fcd9a7c0577ec8ca3059 Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Wed, 5 Aug 2026 11:14:11 +0200 +Subject: [PATCH] words: bound the IRC server line buffer (Fixes #12770) + +CVE: CVE-2026-115776 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/ac90fb7b0ab73688a581fcd9a7c0577ec8ca3059] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/words/newsfragments/12770.bugfix | 1 + + src/twisted/words/protocols/irc.py | 21 ++++++++++++++ + src/twisted/words/test/test_irc.py | 29 ++++++++++++++++++++ + 3 files changed, 51 insertions(+) + create mode 100644 src/twisted/words/newsfragments/12770.bugfix + +diff --git a/src/twisted/words/newsfragments/12770.bugfix b/src/twisted/words/newsfragments/12770.bugfix +new file mode 100644 +index 000000000..6bf3a63ee +--- /dev/null ++++ b/src/twisted/words/newsfragments/12770.bugfix +@@ -0,0 +1 @@ ++twisted.words.protocols.irc.IRC now limits the length of a single line, so a peer can no longer exhaust server memory by sending data without a line delimiter. +diff --git a/src/twisted/words/protocols/irc.py b/src/twisted/words/protocols/irc.py +index 2906fa562..1123cdc4a 100644 +--- a/src/twisted/words/protocols/irc.py ++++ b/src/twisted/words/protocols/irc.py +@@ -255,6 +255,9 @@ class IRC(protocol.Protocol): + """ + + buffer = "" ++ # Longest line accepted, matching twisted.protocols.basic.LineReceiver. ++ # An unterminated line would otherwise grow self.buffer without bound. ++ MAX_LENGTH = 16384 + hostname = None + + encoding: Optional[str] = None +@@ -415,8 +418,15 @@ class IRC(protocol.Protocol): + # Put the (possibly empty) element after the last LF back in the + # buffer + self.buffer = lines.pop() ++ if len(self.buffer) > self.MAX_LENGTH: ++ # An unterminated line too long to be a valid message. ++ line, self.buffer = self.buffer, "" ++ return self.lineLengthExceeded(line) + + for line in lines: ++ if len(line) > self.MAX_LENGTH: ++ self.buffer = "" ++ return self.lineLengthExceeded(line) + if len(line) <= 2: + # This is a blank line, at best. + continue +@@ -429,6 +439,17 @@ class IRC(protocol.Protocol): + + self.handleCommand(command, prefix, params) + ++ def lineLengthExceeded(self, line): ++ """ ++ Called when a line longer than C{MAX_LENGTH} is received. The default ++ behaviour, matching L{twisted.protocols.basic.LineReceiver}, drops the ++ connection. ++ ++ @param line: The line which exceeded the length limit. ++ @type line: L{str} ++ """ ++ return self.transport.loseConnection() ++ + def handleCommand(self, command, prefix, params): + """ + Determine the function to call for the given command and call it with +diff --git a/src/twisted/words/test/test_irc.py b/src/twisted/words/test/test_irc.py +index c30cfc522..cd400f9ed 100644 +--- a/src/twisted/words/test/test_irc.py ++++ b/src/twisted/words/test/test_irc.py +@@ -1522,6 +1522,35 @@ class BasicServerFunctionalityTests(IRCTestCase): + bufferValue = bufferValue.decode("utf-8") + self.assertEqual(bufferValue, s) + ++ def test_dataReceivedBoundsUnterminatedLine(self) -> None: ++ """ ++ A line longer than L{irc.IRC.MAX_LENGTH} that arrives without a ++ delimiter is not buffered without bound. The buffer is cleared and the ++ connection is dropped, matching L{twisted.protocols.basic.LineReceiver}. ++ """ ++ self.p.dataReceived(b"A" * (self.p.MAX_LENGTH + 1)) ++ self.assertEqual(self.p.buffer, "") ++ self.assertTrue(self.t.closed) ++ ++ def test_dataReceivedDropsOverlongTerminatedLine(self) -> None: ++ """ ++ A delimited line longer than L{irc.IRC.MAX_LENGTH} is dropped rather ++ than dispatched. ++ """ ++ self.p.dataReceived(b"A" * (self.p.MAX_LENGTH + 1) + b"\n") ++ self.assertEqual(self.p.buffer, "") ++ self.assertTrue(self.t.closed) ++ ++ def test_dataReceivedAcceptsBoundedInput(self) -> None: ++ """ ++ Input under the length limit is buffered normally and the connection is ++ left open. ++ """ ++ self.p.dataReceived(b"\r\n") ++ self.p.dataReceived(b"AB") ++ self.assertEqual(self.p.buffer, "AB") ++ self.assertFalse(self.t.closed) ++ + def test_sendMessage(self): + """ + Passing a command and parameters to L{IRC.sendMessage} results in a
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch new file +79 -0
79 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +2 -0
@@ -22,6 +22,8 @@ SRC_URI += "file://CVE-2026-42304_p1.patch \ file://CVE-2026-115877_p3.patch \ file://CVE-2026-115774_p1.patch \ file://CVE-2026-115774_p2.patch \ + file://CVE-2026-115776_p1.patch \ + file://CVE-2026-115776_p2.patch \ " SRC_URI[sha256sum] = "1deb272358cb6be1e3e8fc6f9c8b36f78eb0fa7c2233d2dbe11ec6fee04ea316"
Signature · 1 line
2.53.0
PATCH 5/5 python3-twisted: Fix CVE-2026-115778
In reply to Yogita UradeThis patch applies the upstream fix as referenced in [5], using the commit shown in [1], [2], [3] and [4].
[1] https://github.com/twisted/twisted/commit/5d91cc66a3591faba758a80a1479e0103602facc
[2] https://github.com/twisted/twisted/commit/073ba878c6c07d569cb61abc5ae76d46eff1b529
[3] https://github.com/twisted/twisted/commit/306985969879a8aeab811e9730b3d0e54ff372e8
[4] https://github.com/twisted/twisted/commit/1baff09a1d56ca9254a6d6f02005f17a7c53a282
[5] https://github.com/twisted/twisted/pull/12750
[6] https://nvd.nist.gov/vuln/detail/cve-2026-115778
--- .../python3-twisted/CVE-2026-115778_p1.patch | 105 +++++++ .../python3-twisted/CVE-2026-115778_p2.patch | 286 ++++++++++++++++++ .../python3-twisted/CVE-2026-115778_p3.patch | 108 +++++++ .../python3-twisted/CVE-2026-115778_p4.patch | 36 +++ .../python/python3-twisted_25.5.0.bb | 4 + 5 files changed, 539 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch new file +105 -0
@@ -0,0 +1,105 @@ +From 5d91cc66a3591faba758a80a1479e0103602facc Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Thu, 30 Jul 2026 11:07:01 +0200 +Subject: [PATCH] conch.telnet: bound the subnegotiation buffer to prevent a memory DoS (Fixes #12706) + +CVE: CVE-2026-115778 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/5d91cc66a3591faba758a80a1479e0103602facc] + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/conch/newsfragments/12706.bugfix | 1 + + src/twisted/conch/telnet.py | 12 +++++++-- + src/twisted/conch/test/test_telnet.py | 27 ++++++++++++++++++++ + 3 files changed, 38 insertions(+), 2 deletions(-) + create mode 100644 src/twisted/conch/newsfragments/12706.bugfix + +diff --git a/src/twisted/conch/newsfragments/12706.bugfix b/src/twisted/conch/newsfragments/12706.bugfix +new file mode 100644 +index 000000000..5c9782e64 +--- /dev/null ++++ b/src/twisted/conch/newsfragments/12706.bugfix +@@ -0,0 +1 @@ ++twisted.conch.telnet.Telnet now limits how much data it buffers for a single telnet subnegotiation, so a peer can no longer exhaust server memory by sending a subnegotiation that is never terminated. +diff --git a/src/twisted/conch/telnet.py b/src/twisted/conch/telnet.py +index 4221bf90a..d008b354a 100644 +--- a/src/twisted/conch/telnet.py ++++ b/src/twisted/conch/telnet.py +@@ -377,6 +377,9 @@ class Telnet(protocol.Protocol): + # One of a lot of things + state = "data" + ++ # Cap the per-subnegotiation buffer against an unterminated IAC SB. ++ MAX_SUBNEGOTIATION_LENGTH = 4096 ++ + def __init__(self): + self.options = {} + self.negotiationMap = {} +@@ -517,6 +520,11 @@ class Telnet(protocol.Protocol): + data = data.replace(IAC, IAC * 2) + self._write(IAC + SB + about + data + IAC + SE) + ++ def _bufferSubnegotiation(self, b): ++ # Append until the cap, then drop the rest. ++ if len(self.commands) < self.MAX_SUBNEGOTIATION_LENGTH: ++ self.commands.append(b) ++ + def dataReceived(self, data): + appDataBuffer = [] + +@@ -579,7 +587,7 @@ class Telnet(protocol.Protocol): + if b == IAC: + self.state = "subnegotiation-escaped" + else: +- self.commands.append(b) ++ self._bufferSubnegotiation(b) + elif self.state == "subnegotiation-escaped": + if b == SE: + self.state = "data" +@@ -591,7 +599,7 @@ class Telnet(protocol.Protocol): + self.negotiate(commands) + else: + self.state = "subnegotiation" +- self.commands.append(b) ++ self._bufferSubnegotiation(b) + else: + raise ValueError("How'd you do this?") + +diff --git a/src/twisted/conch/test/test_telnet.py b/src/twisted/conch/test/test_telnet.py +index b32fdfd3b..7df22d08a 100644 +--- a/src/twisted/conch/test/test_telnet.py ++++ b/src/twisted/conch/test/test_telnet.py +@@ -263,6 +263,33 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.data, b"".join(L).replace(cmd, b"")) + self.assertEqual(h.subcmd, [telnet.SE] + list(iterbytes(b"hello"))) + ++ def test_subnegotiationBufferIsBounded(self): ++ # An unterminated subnegotiation is capped and the connection stays open. ++ cap = telnet.Telnet.MAX_SUBNEGOTIATION_LENGTH ++ self.p.dataReceived(telnet.IAC + telnet.SB + b"\x12") ++ self.p.dataReceived(b"A" * (cap * 4)) ++ self.assertEqual(len(self.p.commands), cap) ++ self.assertFalse(self.t.disconnecting) ++ ++ def test_oversizedSubnegotiationIsTruncated(self): ++ # An over-long subnegotiation is delivered truncated, not dropped. ++ h = self.p.protocol ++ cap = telnet.Telnet.MAX_SUBNEGOTIATION_LENGTH ++ cmd = ( ++ telnet.IAC + telnet.SB + b"\x12" + b"B" * (cap * 2) + telnet.IAC + telnet.SE ++ ) ++ self.p.dataReceived(cmd) ++ self.assertEqual(len(h.subcmd), cap - 1) ++ self.assertFalse(self.t.disconnecting) ++ ++ def test_subnegotiationEscapedBytesCountTowardCap(self): ++ # IAC-escaped bytes (IAC IAC) also count toward the cap. ++ cap = telnet.Telnet.MAX_SUBNEGOTIATION_LENGTH ++ self.p.dataReceived(telnet.IAC + telnet.SB + b"\x12") ++ self.p.dataReceived((telnet.IAC + telnet.IAC) * (cap * 2)) ++ self.assertEqual(len(self.p.commands), cap) ++ self.assertFalse(self.t.disconnecting) ++ + def _enabledHelper(self, o, eL=[], eR=[], dL=[], dR=[]): + self.assertEqual(o.enabledLocal, eL) + self.assertEqual(o.enabledRemote, eR)
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch new file +286 -0
286 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch new file +108 -0
108 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch new file +36 -0
@@ -0,0 +1,36 @@ +From 1baff09a1d56ca9254a6d6f02005f17a7c53a282 Mon Sep 17 00:00:00 2001 +From: arkmarta <[email protected]> +Date: Sat, 22 Aug 2026 14:06:08 +0200 +Subject: [PATCH] use transport.disconnecting for the subnegotiation drop guard + +CVE: CVE-2026-115778 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/1baff09a1d56ca9254a6d6f02005f17a7c53a282] + +Backport Changes: +- Upstream removes the temporary _subnegotiationOverflowReported flag + and its class-docstring text. The earlier CVE-2026-115778_p2 patch + already uses transport.disconnecting as the overflow guard, so that + cleanup does not apply to this target patch series. The transport + assertion and type-ignore annotation follow upstream. + +Signed-off-by: Yogita Urade <[email protected]> +--- + src/twisted/conch/telnet.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/twisted/conch/telnet.py b/src/twisted/conch/telnet.py +index 6dbb65c9e..480883d02 100644 +--- a/src/twisted/conch/telnet.py ++++ b/src/twisted/conch/telnet.py +@@ -549,7 +549,10 @@ class Telnet(protocol.Protocol): + C{disconnecting} guard keeps this to a single log line if more + subnegotiation payload arrives while the connection is still closing. + """ +- if self.transport.disconnecting: ++ assert self.transport is not None ++ # disconnecting is not declared on ITransport, but every real transport ++ # implements it. ++ if self.transport.disconnecting: # type: ignore[attr-defined] + return + self._log.warn( + "Telnet subnegotiation exceeded {length} bytes without an "
meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +4 -0
@@ -24,6 +24,10 @@ SRC_URI += "file://CVE-2026-42304_p1.patch \ file://CVE-2026-115774_p2.patch \ file://CVE-2026-115776_p1.patch \ file://CVE-2026-115776_p2.patch \ + file://CVE-2026-115778_p1.patch \ + file://CVE-2026-115778_p2.patch \ + file://CVE-2026-115778_p3.patch \ + file://CVE-2026-115778_p4.patch \ " SRC_URI[sha256sum] = "1deb272358cb6be1e3e8fc6f9c8b36f78eb0fa7c2233d2dbe11ec6fee04ea316"
Signature · 1 line
2.53.0