From patchwork Tue Nov 24 06:00:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yogita Urade -X (yurade - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 105317 Received: from aer-iport-1.cisco.com (aer-iport-1.cisco.com [173.38.203.51]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.12224.1795500042120444151 for ; Mon, 23 Nov 2026 22:00:43 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=a4RjYBRX; spf=pass (domain: cisco.com, ip: 173.38.203.51, mailfrom: yurade@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=13522; q=dns/txt; s=iport01; t=1795500043; x=1796709643; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=g4REPV/0QhJjfunmx6sL2fXubqIggCHFc6Bu/akOTRY=; b=a4RjYBRXygcYVwabJN2/NknM9k2o1A36quOao5HRdBgZ0ZXyubanJBe+ ayYV48upebyyWRf3HMzDHeNYZvoqa35ACrp1koyITbXh97VT43yjMhO5Q wrYoUf0+mM8lHh8xgT3rN4RNQUuY/LVLxjXdHo6o8wUU0e0+8wJTPnEU8 /Pz1L6LBZ3HL/XC+03BOaL1Ad23/WFRm4cbW929p+PN/1mgvmsqCG90Px EqJiuncUaBBd2BIx+fffRPgYYzOISADlWJ30ZI4hS+zaoaFtyoqpYXdw+ qan1v/HSwX75stPY3B8Dqzg7VVI/+ccJZwFI64f/tuAaf3vFsR1MIHJ8U g==; X-CSE-ConnectionGUID: T6tQXJZ9So+t27oRpt9hTA== X-CSE-MsgGUID: e5OJkcMKRK+oSbjoP0lI9g== X-IPAS-Result: A0BLAgBEJQVr/9FK/pBaHgE8DA4LgVmCV3VgQ0mUKoIhA54pFIFqDwEBAQ9EDQQBAYQ/RgKOIgImNAkO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29h VjlvGPCCBMdDISb6GuKpyfEaujn2HmTtJgpPLqg+/hnhVeeymAeBFgaWEW2pdG9i1WiQJRYM 0ES9y8koKQ++UDtScPyNyBUu1aNswRZX59bFPc3rVndjKHV+A2eQGMDS1atdeAbiSP/fhRyv nfhoj8jLWYHXGG9IZ5FyoqpkA== IronPort-HdrOrdr: A9a23:1fDs7K6uU2bjiFf+dgPXwOTXdLJyesId70hD6qkXc20wTiX2ra 6TdZgguCMczQxhO03I+urwXZVoP0m8yXcd2+B4Vt2ftUvdyQmVxepZgrcKrQeNJ8SHzI5g/J YlVbRiA9vtClU/p8P77A6kV+sE+rC8gceVbSO09QYVcemsAJsQiTtENg== X-Talos-CUID: 9a23:wMr9MWt6bYVXPfSVu+0zdhn66IsZLGHk/FXicnS/SnozF7qvUUPB+J9Nxp8= X-Talos-MUID: 9a23:Fci3JQ2RCTkn5GyLMBLWWcOJaTUj7vmJKkMGtLY8mIqDDiZyPA/FiBXmTdpy X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,229,1787011200"; d="scan'208";a="62756809" Received: from aer-l-core-08.cisco.com ([144.254.74.209]) by aer-iport-1.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 24 Nov 2026 06:00:38 +0000 Received: from sjc-ads-7310.cisco.com (sjc-ads-7310.cisco.com [10.30.220.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ciscoit-managed-infra-smtp-auth.cisco.com", Issuer "Internal Private TLS SubCA" (verified OK)) by aer-l-core-08.cisco.com (Postfix) with ESMTPS id 070BB180001A2 for ; Tue, 24 Nov 2026 06:00:38 +0000 (GMT) Received: by sjc-ads-7310.cisco.com (Postfix, from userid 1889728) id A8BCACC12A7; Mon, 23 Nov 2026 22:00:36 -0800 (PST) From: Yogita Urade To: openembedded-devel@lists.openembedded.org Subject: [oe][meta-python][wrynose][PATCH 1/5] python3-twisted: Fix CVE-2026-83813 Date: Mon, 23 Nov 2026 22:00:31 -0800 Message-Id: <20261124060035.1651451-2-yurade@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261124060035.1651451-1-yurade@cisco.com> References: <20261124060035.1651451-1-yurade@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: VERIFIED;sjc-ads-7310.cisco.com [10.30.220.95];TLSv1.3;TLS_AES_256_GCM_SHA384;256;ciscoit-managed-infra-smtp-auth.cisco.com X-Outbound-SMTP-Client: 10.30.220.95, sjc-ads-7310.cisco.com X-Outbound-Node: aer-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 06:00:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132925 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 Signed-off-by: Yogita Urade --- .../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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch new file mode 100644 index 0000000000..864cad2a99 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813-regression.patch @@ -0,0 +1,62 @@ +From 80d4907046def3e839b30dfff860564cb0311082 Mon Sep 17 00:00:00 2001 +From: Glyph +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch new file mode 100644 index 0000000000..18f5306acd --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p1.patch @@ -0,0 +1,62 @@ +From b53e1c3477c209b5609a1c74cf9e48373b5879ac Mon Sep 17 00:00:00 2001 +From: Glyph +Date: Wed, 15 Jul 2026 21:14:40 -0700 +Subject: [PATCH] drop responses sent from the wrong host or port + +CVE: CVE-2026-83813 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/b53e1c3477c209b5609a1c74cf9e48373b5879ac] + +Signed-off-by: Yogita Urade +--- + src/twisted/names/dns.py | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/twisted/names/dns.py b/src/twisted/names/dns.py +index ca5079454..650194842 100644 +--- a/src/twisted/names/dns.py ++++ b/src/twisted/names/dns.py +@@ -3346,13 +3346,17 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + + resends = None + +- def stopProtocol(self): ++ # map of message-id:address ++ _addressValidation: dict[int, tuple[str, int]] ++ ++ def stopProtocol(self) -> None: + """ + Stop protocol: reset state variables. + """ + self.liveMessages = {} + self.resends = {} +- self.transport = None ++ self.transport = None # type:ignore[assignment] ++ self._addressValidation = {} + + def startProtocol(self): + """ +@@ -3360,6 +3364,7 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + """ + self.liveMessages = {} + self.resends = {} ++ self._addressValidation = {} + + def writeMessage(self, message, address): + """ +@@ -3395,6 +3400,8 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + return + + if m.id in self.liveMessages: ++ if self._addressValidation[m.id] != addr: ++ return + d, canceller = self.liveMessages[m.id] + del self.liveMessages[m.id] + canceller.cancel() +@@ -3443,6 +3450,7 @@ class DNSDatagramProtocol(DNSMixin, protocol.DatagramProtocol): + def writeMessage(m): + self.writeMessage(m, address) + ++ self._addressValidation[id] = address + return self._query(queries, timeout, id, writeMessage) + + diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch new file mode 100644 index 0000000000..787839bcae --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p2.patch @@ -0,0 +1,36 @@ +From fce7991ca2a2c17f3e8f86fb18c2aa17eed2c7e1 Mon Sep 17 00:00:00 2001 +From: Glyph +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch new file mode 100644 index 0000000000..55f2ceb92e --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p3.patch @@ -0,0 +1,35 @@ +From 83f2165703766ba1fd7dc40638ac462bae6924d1 Mon Sep 17 00:00:00 2001 +From: Glyph +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch new file mode 100644 index 0000000000..ab3d3721b2 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-83813_p4.patch @@ -0,0 +1,28 @@ +From f6ee6cf35053382a356ec6f0fff490734737e06c Mon Sep 17 00:00:00 2001 +From: Glyph +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb index 9b40191964..978627077f 100644 --- a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +++ b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb @@ -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" From patchwork Tue Nov 24 06:00:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yogita Urade -X (yurade - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 105315 Received: from aer-iport-3.cisco.com (aer-iport-3.cisco.com [173.38.203.53]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.12223.1795500040552522772 for ; Mon, 23 Nov 2026 22:00:41 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=L5JOIWd4; spf=pass (domain: cisco.com, ip: 173.38.203.53, mailfrom: yurade@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=10537; q=dns/txt; s=iport01; t=1795500040; x=1796709640; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=fJfkSJju4qBcP/psoaa+0Dlp29jj+Ai+tNKjW7RVtRQ=; b=L5JOIWd4egDA6I1eZa8I4KYmOlCLDIbEmWlXfkvnLzMFdKUYMPT/Wn03 8ibuneg57C5o0pYwveYqUpcu6xnZ0AIfk8lmfHdnxKSiqGWoZV1EWNW/F MPn2rnH93ydSe+zopAM4RdRNQaKFSqsXKQjWjYOTMbzkk7itIyx2H6TE6 x+/t+eIWXPIqG2pIQDAJvtoBZxFnJRNxs6X+Ac9Bf1LF15Ozi0aQIUJKw NUTvxAvWZrY7/BdhqhdRFOop2UszfI54jiANg0jNpeHxIbTAO5KXYiW3p M7u0UZFbmRdj2gEjEAjBfijw1qbl+gI0ig3n6sqWmm28NqHjfCJQBpIpU w==; X-CSE-ConnectionGUID: RRRFFFonTB6w9HNDs9yIjg== X-CSE-MsgGUID: +xt5gwuvT+e6isdufZrTow== X-IPAS-Result: A0ATBABBJgVr/9NK/pBaglmCV3VgQ0kDlCeCIQOKTIhYiwWBfg8BAQEPRA0EAQGEP0YCjiICJjQJDgECBAMCAwEBAQEBAQEBAQEBAQoBAQUBAQECAQcFgQ4Thk8NkBIBAgEDJwsBGAEbIhwDAQIvKyMIGYMCAYJ0AxG6boF5M4EBgykBPwJDUNlLgWgBCxQBgTiFQogkXRgBhH0nG4FJRIEVgTuCL4EFgVwBAYEnEYZuBIMugVSNFwKBT4hJSIEeA1ksAVUTDQoLBwWBaAM1EioVbjIdgSM7F4EHGwYFgRyBHoESgQNdgSsoXiGBCIF2AoJRggACAUlBDgdFUwklQxJHJCIIEgkBExosCoEaNTwJJj8VDGcLGgVhCAINDHQ5EDAeJC8FGiY+GwqBDCcfHhsOAh8QBhYhCxsYDUgRLDcVGQQ+bgeU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BQpcUAUdAY0++/YTzrdHFLeA== X-Talos-CUID: 9a23:wUrwMG7VAt45S2KJddssznQuNO4LdXvh5inPcm+eJX04WZyXRgrF X-Talos-MUID: 9a23:cY+m+A/NPeiEKZvpi+e2Nz+Qf4R4//mhF10TrdYL5cifOTF+CS2hiyviFw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,229,1787011200"; d="scan'208";a="60398416" Received: from aer-l-core-10.cisco.com ([144.254.74.211]) by aer-iport-3.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 24 Nov 2026 06:00:38 +0000 Received: from sjc-ads-7310.cisco.com (sjc-ads-7310.cisco.com [10.30.220.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ciscoit-managed-infra-smtp-auth.cisco.com", Issuer "Internal Private TLS SubCA" (verified OK)) by aer-l-core-10.cisco.com (Postfix) with ESMTPS id 0C18918000B73 for ; Tue, 24 Nov 2026 06:00:38 +0000 (GMT) Received: by sjc-ads-7310.cisco.com (Postfix, from userid 1889728) id AB7C6CC12A8; Mon, 23 Nov 2026 22:00:36 -0800 (PST) From: Yogita Urade To: openembedded-devel@lists.openembedded.org Subject: [oe][meta-python][wrynose][PATCH 2/5] python3-twisted: Fix CVE-2026-115877 Date: Mon, 23 Nov 2026 22:00:32 -0800 Message-Id: <20261124060035.1651451-3-yurade@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261124060035.1651451-1-yurade@cisco.com> References: <20261124060035.1651451-1-yurade@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: VERIFIED;sjc-ads-7310.cisco.com [10.30.220.95];TLSv1.3;TLS_AES_256_GCM_SHA384;256;ciscoit-managed-infra-smtp-auth.cisco.com X-Outbound-SMTP-Client: 10.30.220.95, sjc-ads-7310.cisco.com X-Outbound-Node: aer-l-core-10.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 06:00:45 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132922 This 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 Signed-off-by: Yogita Urade --- .../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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch new file mode 100644 index 0000000000..3f824788b8 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p1.patch @@ -0,0 +1,71 @@ +From 1616f702d36eda8990a5a5b22ad70fab140a7eb1 Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch new file mode 100644 index 0000000000..9929fd9c5c --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p2.patch @@ -0,0 +1,30 @@ +From 022b6f7feb5980166c71f54e2c0d8f4f21ff6e1a Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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 + diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch new file mode 100644 index 0000000000..10508544d8 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115877_p3.patch @@ -0,0 +1,78 @@ +From 9b826a307b1f5d16df84bce2bdb2a3c70dabf06c Mon Sep 17 00:00:00 2001 +From: arkmarta +Date: Sat, 1 Aug 2026 07:41:38 +0200 +Subject: [PATCH] web: address review, fold header control-char tests into one + +CVE: CVE-2026-115877 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/9b826a307b1f5d16df84bce2bdb2a3c70dabf06c] + +Signed-off-by: Yogita Urade +--- + src/twisted/web/http.py | 1 - + src/twisted/web/test/test_http.py | 36 +++++++++++-------------------- + 2 files changed, 13 insertions(+), 24 deletions(-) + +diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py +index b6ee3e5a5..32c164fcc 100644 +--- a/src/twisted/web/http.py ++++ b/src/twisted/web/http.py +@@ -2510,7 +2510,6 @@ class HTTPChannel(basic.LineReceiver, policies.TimeoutMixin): + + data = data.strip(b" \t") + # 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 +diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py +index 1c4bd8a21..fd362fd41 100644 +--- a/src/twisted/web/test/test_http.py ++++ b/src/twisted/web/test/test_http.py +@@ -2194,34 +2194,24 @@ class ParsingTests(unittest.TestCase): + [b"GET / HTTP/1.1", b"Host: foo.example", header, b"", b""] + ) + +- def test_invalidHeaderValueNUL(self): ++ def test_invalidHeaderValueControlChars(self) -> None: + """ +- A request with a header value that contains a NUL byte +- is rejected with a 400 status code. +- """ +- for header in [ +- b"x-foo: \x00", # NUL byte +- b"x-foo: a\x00", # trailing NUL +- b"x-foo: \x00baz", # leading NUL +- b"x-foo: \x00\x00\x00x0\0 ", # lots of NULs +- ]: +- self.assertRequestRejected( +- [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. ++ A header value containing NUL, CR, or LF is rejected with a 400 (RFC ++ 9110 section 5.5). A bare CR or LF would additionally let a following ++ header be hidden from the parser, enabling request smuggling. + """ + 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"\x00", # NUL ++ b"a\x00", # trailing NUL ++ b"\x00baz", # leading NUL + b"a\rb", # bare CR ++ b"a\rContent-Length: 5", # bare CR hiding a header + ]: ++ self.assertRequestRejected( ++ [b"GET / HTTP/1.1", b"Host: foo.example", b"x-foo: " + value, b"", b""] ++ ) ++ # runRequest normalises a bare LF to CRLF, so feed those bytes directly. ++ for value in [b"a\nb", b"a\nContent-Length: 5"]: + channel = http.HTTPChannel() + transport = StringTransport() + channel.makeConnection(transport) diff --git a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb index 978627077f..78e74fa491 100644 --- a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +++ b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb @@ -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" From patchwork Tue Nov 24 06:00:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yogita Urade -X (yurade - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 105319 Received: from aer-iport-2.cisco.com (aer-iport-2.cisco.com [173.38.203.52]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.12226.1795500045500319680 for ; Mon, 23 Nov 2026 22:00:45 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=BTVn2o72; spf=pass (domain: cisco.com, ip: 173.38.203.52, mailfrom: yurade@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=5713; q=dns/txt; s=iport01; t=1795500045; x=1796709645; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=p9Ft1fv1Qt0RW5HcrQMiG19EOidPSFvwv/BhO0bdB3I=; b=BTVn2o72KWZDtVFiW8nQJlbpdmRBWlQNwMQiaiAKrpH92j/Vzh8vIRMx AuGo6X7AebkHJ8mLczdXGRZzCfW5stPGllNZ9BnH2+nvmg8oqI7/h6t81 vOgs2R3dZQuPKgu8FDW67/ENhUTDj1ZbsQUe8KU5bMibjhrzt/BEolQeo KwmdevJYHpr3/Thhf6LfLQiKpYMrwz3d9eAxzklm5qwDb0xVEGYptu53I 1FZq82A6SYuajL7P9jghesCqRg5RaIhC1X2q3ezUTowXYUaQVT4OsFcE4 uwLgX+gMykdGnf03SAVKXst0DtFCIJ1RcERADAH2LJdcTj1c6K2E5c6BV w==; X-CSE-ConnectionGUID: P4TIkvtWQ1W487VkxziDpQ== X-CSE-MsgGUID: F64SEj66T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mFS/0nWpvEBa7N4Le03h9p2pwIR6uCI ZVFL2A3MXwsYDUXUrsTIIMjhu6ki1H0ciZTrxSeoq9fD237klYujeCzaoW9ltqia5sJpWua+ Dz67T7iLEE5aMPE8iWK/Sf57gPItWahMG4IL5W/7vNsjViZy2AfBRFTWValrP2Rjk+lR8kZL FQZ/Ccrp6U++EGnCN7nUHWFTGWstxMGHt4VGOog5UTVluzf4h2SAS4PSTsphMEaifLajAcCj jeh9+4FzxQ22FFJYRpxLoupkA4= IronPort-HdrOrdr: A9a23:G+j7Laru9u2ngATR/oDrDiUaV5oHeYIsimQD101hICG9Ffbo8/ xG88506faZslsssTQb6LO90cq7MBbhHOBOgLX5VI3KNGKNhILrFvAB0WKI+VLd8kPFmtK1rZ 0BT4FOTPvtEFN9kcH2pCO8E9om3Z271ZrAv5a485+oJjsaEp2JKGxCe2CmLnE= X-Talos-CUID: 9a23:4BrShWnHCxIl6TQcReweYWXq9HbXOUWB8FbTPVOHMD9WFO3Kd1yA6qJIi/M7zg== X-Talos-MUID: 9a23:to886QuoDaSDuZ5BQc2nqm8+D+pqvfqSGhoWv8Ul59bfDjN/NGLI X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,230,1787011200"; d="scan'208";a="62750627" Received: from aer-l-core-04.cisco.com ([144.254.74.205]) by aer-iport-2.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 24 Nov 2026 06:00:38 +0000 Received: from sjc-ads-7310.cisco.com (sjc-ads-7310.cisco.com [10.30.220.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ciscoit-managed-infra-smtp-auth.cisco.com", Issuer "Internal Private TLS SubCA" (verified OK)) by aer-l-core-04.cisco.com (Postfix) with ESMTPS id 0F28F18000348 for ; Tue, 24 Nov 2026 06:00:38 +0000 (GMT) Received: by sjc-ads-7310.cisco.com (Postfix, from userid 1889728) id B1971CC12A9; Mon, 23 Nov 2026 22:00:36 -0800 (PST) From: Yogita Urade To: openembedded-devel@lists.openembedded.org Subject: [oe][meta-python][wrynose][PATCH 3/5] python3-twisted: Fix CVE-2026-115774 Date: Mon, 23 Nov 2026 22:00:33 -0800 Message-Id: <20261124060035.1651451-4-yurade@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261124060035.1651451-1-yurade@cisco.com> References: <20261124060035.1651451-1-yurade@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: VERIFIED;sjc-ads-7310.cisco.com [10.30.220.95];TLSv1.3;TLS_AES_256_GCM_SHA384;256;ciscoit-managed-infra-smtp-auth.cisco.com X-Outbound-SMTP-Client: 10.30.220.95, sjc-ads-7310.cisco.com X-Outbound-Node: aer-l-core-04.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 06:00:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132927 This 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 Signed-off-by: Yogita Urade --- .../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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch new file mode 100644 index 0000000000..3b72fd4994 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p1.patch @@ -0,0 +1,55 @@ +From 3d125548bcbe955007cb97f480bb699a5e074741 Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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), diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch new file mode 100644 index 0000000000..254248df2a --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115774_p2.patch @@ -0,0 +1,26 @@ +From a97aa5babb151b5d1aebf1c14596c786cd0bf105 Mon Sep 17 00:00:00 2001 +From: Glyph +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 +--- + 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. diff --git a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb index 78e74fa491..7ba179c455 100644 --- a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +++ b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb @@ -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" From patchwork Tue Nov 24 06:00:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yogita Urade -X (yurade - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 105316 Received: from aer-iport-8.cisco.com (aer-iport-8.cisco.com [173.38.203.70]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.12459.1795500042234081347 for ; Mon, 23 Nov 2026 22:00:42 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=ZpSY9xq0; spf=pass (domain: cisco.com, ip: 173.38.203.70, mailfrom: yurade@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=9636; q=dns/txt; s=iport01; t=1795500042; x=1796709642; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=w6/hhazQT4QMvJwcFtEJPFLCd1DZCQFSNIhEwGVYLW8=; b=ZpSY9xq0aqTxeH+QOLh3ca4/x7kWteAr4zlI3s5cp04HNg8CLBSry7us NLJrDQ0saRnH8GwTkARIH2eb7yKP6rItkO7Fx2xLoC0t57fBIo4g0J4Tr bpqGVuXz0cZ1PEJBNjRcdK8KTce/J3PnHeBGSk1PQjvEGFJKVX2RQmeG2 5lXmcTJZ+rBGnRDkhi0qZC+FbiI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0LGj82rFyAwmA9Wjn6yTWhVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0NS+7vw60c+VZk 72hg3AfpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn3bEm51T4E8K0YIw9bZbUVBLq tEkI2oDQimGjrKn36PkVbw57igjBJGD0II3s3x6iDWcBvE8TNWbE+PB5MRT23E7gcUm8fT2P pZFL2AyMFKfP1sVYgZ/5JEWxI9EglHubidRpF+9rqss6G+Vxwt0uFToGISNI4HVG5kL9qqej k/9+TzZByNKDcC45RCZyG31tMbLvxquDer+E5X9rJaGmma7wXQeDhATX1a3rfS1z0KzRd9bA 0gV4TY1668q+UqmS9PwUxG1rDiDpBF0ZjZLO+Q38kSJj6HT+QvcXjhCRT9aY9tgv8gzLdA36 mK0cxrSLWQHmNWopbi1r994cRva1fApEFI/ IronPort-HdrOrdr: A9a23:TW675K7XrUaW70xrTgPXwOTXdLJyesId70hD6qkXc20wTiX2ra 6TdZgguCMczQxhO03I+urwXZVoP0m8yXcd2+B4Vt2ftUvdyQmVxepZgrcKrQeNJ8SHzI5g/J YlVbRiA9vtClU/p8P77A6kV+sE+rC8gceVbSO09QYVcemsAJsQiTtENg== X-Talos-CUID: 9a23:JwAZlWmy8g+xo4NsAf62ZmIwbLvXOXKN4CfhJhCVNW0zRpGsTFbA6bx1zNU7zg== X-Talos-MUID: 9a23:KUozxwSwavWNkw8MRXTBvzc6FMJas52yL2wnja8Z4vutMQ5JbmI= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,229,1787011200"; d="scan'208";a="60157646" Received: from aer-l-core-08.cisco.com ([144.254.74.209]) by aer-iport-8.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 24 Nov 2026 06:00:38 +0000 Received: from sjc-ads-7310.cisco.com (sjc-ads-7310.cisco.com [10.30.220.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ciscoit-managed-infra-smtp-auth.cisco.com", Issuer "Internal Private TLS SubCA" (verified OK)) by aer-l-core-08.cisco.com (Postfix) with ESMTPS id 11DB418000279 for ; Tue, 24 Nov 2026 06:00:38 +0000 (GMT) Received: by sjc-ads-7310.cisco.com (Postfix, from userid 1889728) id B87C5CC124A; Mon, 23 Nov 2026 22:00:36 -0800 (PST) From: Yogita Urade To: openembedded-devel@lists.openembedded.org Subject: [oe][meta-python][wrynose][PATCH 4/5] python3-twisted: Fix CVE-2026-115776 Date: Mon, 23 Nov 2026 22:00:34 -0800 Message-Id: <20261124060035.1651451-5-yurade@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261124060035.1651451-1-yurade@cisco.com> References: <20261124060035.1651451-1-yurade@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: VERIFIED;sjc-ads-7310.cisco.com [10.30.220.95];TLSv1.3;TLS_AES_256_GCM_SHA384;256;ciscoit-managed-infra-smtp-auth.cisco.com X-Outbound-SMTP-Client: 10.30.220.95, sjc-ads-7310.cisco.com X-Outbound-Node: aer-l-core-08.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 06:00:46 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132924 This 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 Signed-off-by: Yogita Urade --- .../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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch new file mode 100644 index 0000000000..ceb5c3139e --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p1.patch @@ -0,0 +1,111 @@ +From ac90fb7b0ab73688a581fcd9a7c0577ec8ca3059 Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch new file mode 100644 index 0000000000..55ecb71a66 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115776_p2.patch @@ -0,0 +1,79 @@ +From 01f8cff7753c1edac132380b2ea939fa6bdbab30 Mon Sep 17 00:00:00 2001 +From: arkmarta +Date: Sat, 8 Aug 2026 08:25:06 +0200 +Subject: [PATCH] bound the IRC server line length + +CVE: CVE-2026-115776 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/01f8cff7753c1edac132380b2ea939fa6bdbab30] + +Signed-off-by: Yogita Urade +--- + src/twisted/words/newsfragments/12770.bugfix | 2 +- + src/twisted/words/protocols/irc.py | 19 ++++++++++++------- + 2 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/twisted/words/newsfragments/12770.bugfix b/src/twisted/words/newsfragments/12770.bugfix +index 6bf3a63ee..2a62e440f 100644 +--- a/src/twisted/words/newsfragments/12770.bugfix ++++ b/src/twisted/words/newsfragments/12770.bugfix +@@ -1 +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. ++twisted.words.protocols.irc.IRC.dataReceived 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 1123cdc4a..2249edd99 100644 +--- a/src/twisted/words/protocols/irc.py ++++ b/src/twisted/words/protocols/irc.py +@@ -252,11 +252,14 @@ def parseModes(modes, params, paramModes=("", "")): + class IRC(protocol.Protocol): + """ + Internet Relay Chat server protocol. ++ ++ @cvar MAX_LENGTH: The maximum length of a line to allow. A received line ++ longer than this drops the connection, matching ++ L{twisted.protocols.basic.LineReceiver}, so an unterminated line cannot ++ grow the buffer without bound. Default is 16384. + """ + + buffer = "" +- # Longest line accepted, matching twisted.protocols.basic.LineReceiver. +- # An unterminated line would otherwise grow self.buffer without bound. + MAX_LENGTH = 16384 + hostname = None + +@@ -421,12 +424,14 @@ class IRC(protocol.Protocol): + 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) ++ self.lineLengthExceeded(line) ++ return + + for line in lines: + if len(line) > self.MAX_LENGTH: + self.buffer = "" +- return self.lineLengthExceeded(line) ++ self.lineLengthExceeded(line) ++ return + if len(line) <= 2: + # This is a blank line, at best. + continue +@@ -439,16 +444,16 @@ class IRC(protocol.Protocol): + + self.handleCommand(command, prefix, params) + +- def lineLengthExceeded(self, line): ++ def lineLengthExceeded(self, line: str) -> None: + """ + 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() ++ assert self.transport is not None ++ self.transport.loseConnection() + + def handleCommand(self, command, prefix, params): + """ diff --git a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb index 7ba179c455..72dc23e3fb 100644 --- a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +++ b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb @@ -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" From patchwork Tue Nov 24 06:00:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yogita Urade -X (yurade - E INFOCHIPS PRIVATE LIMITED at Cisco)" X-Patchwork-Id: 105318 Received: from aer-iport-4.cisco.com (aer-iport-4.cisco.com [173.38.203.54]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.12460.1795500044055481053 for ; Mon, 23 Nov 2026 22:00:44 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: message contains an insecure body length tag" header.i=@cisco.com header.s=iport01 header.b=WVLeU1rU; spf=pass (domain: cisco.com, ip: 173.38.203.54, mailfrom: yurade@cisco.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=26487; q=dns/txt; s=iport01; t=1795500044; x=1796709644; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=H07cmVmgxd0rALBWLQffowcfapWfOOcXAgrep/XnMGg=; b=WVLeU1rUeoz3SvCH0kMZRwUievqOHZaAk0x1wPYWy58qYcDd0PQ+fnex q1crxEw8+B0GexIjECEiGhqWy5/jThbIbez68Jdz07NJZHQ9tIY8vtMWe M/7vE0VcSQQUVKb+qFMNuKMO0RMhdTrzKt5W7TDCMffJ6cvk4lHNQBwvg 9RXhgRBq1UkPtG0y2J6oaGsF5KpIi9T+hicrZesHwaFeibb0myRo+fmYZ 5tXQJa28ALlWc/M7TW1BkyuPPqkYteWnDh/5lVxFbmfQp7oQgkHVvDrmV 3g4gC5S2Cq0c3uACSJdH09CX4iQiYd4+TaHqUYct6y6xLXNxTp/dw5Nl6 g==; X-CSE-ConnectionGUID: h2iz4VLDQTyNlLpVnwlz5g== X-CSE-MsgGUID: mD40DWE/Stmp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Vq7 cIeNzQfMx/W0opawJrjIgVtrs0uNozveYgYoHwllW6fBvc9SpeFSKLPjTNa9G5s2oYUQKqYO JZfM2I/BPjDS0Un1lM/GY8kleulrnL+aDZf7lmSoMLb5kCNllIgi+axa7I5fPSPaZkNsnm14 Vna+nzyAC06ZYDPlxS8pyfEaujn2HmTtJgpPLqg+/hnhVeeymAeBFgaWEW2pdG9i1WiQJRYM 0ES9y8koKQ++UDtScPyNyBUu1aNswRZX59bFPc3rVnSjKHV+A2eQGMDS1atdeAbiSP/fhRyv nfhoj8jLWUHXGG9IZ5FyoqpkA== IronPort-HdrOrdr: A9a23:YsyEFKOPwbVW4cBcTu2jsMiBIKoaSvp037BN7TEUdfU7SKKlfq yV8cjzkCWE6wr5O0tQ/OxoRpPgfZq0z/cciuMs1PWZLWvbUQCTQ72Kg7GP/9SZIU3D398Y87 t8eK5jD9C1J117gcHmpDScKb8bsb66GGTCv5am85+rJjsaDZ1d0w== X-Talos-CUID: 9a23:wcITPG8WUYjsLzuLxLiVv05OG9J5TFnx9UvBBUucEVhvV7mHFFDFrQ== X-Talos-MUID: 9a23:56AsNAqy//igBm9LrqYezzROaJ9E3InpM1wIiZ4Eh+nVaXwuFQ7I2Q== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.27,230,1787011200"; d="scan'208";a="62693643" Received: from aer-l-core-07.cisco.com ([144.254.74.208]) by aer-iport-4.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 24 Nov 2026 06:00:40 +0000 Received: from sjc-ads-7310.cisco.com (sjc-ads-7310.cisco.com [10.30.220.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "ciscoit-managed-infra-smtp-auth.cisco.com", Issuer "Internal Private TLS SubCA" (verified OK)) by aer-l-core-07.cisco.com (Postfix) with ESMTPS id 873C718000441 for ; Tue, 24 Nov 2026 06:00:39 +0000 (GMT) Received: by sjc-ads-7310.cisco.com (Postfix, from userid 1889728) id BDC23CC124B; Mon, 23 Nov 2026 22:00:36 -0800 (PST) From: Yogita Urade To: openembedded-devel@lists.openembedded.org Subject: [oe][meta-python][wrynose][PATCH 5/5] python3-twisted: Fix CVE-2026-115778 Date: Mon, 23 Nov 2026 22:00:35 -0800 Message-Id: <20261124060035.1651451-6-yurade@cisco.com> X-Mailer: git-send-email 2.35.6 In-Reply-To: <20261124060035.1651451-1-yurade@cisco.com> References: <20261124060035.1651451-1-yurade@cisco.com> MIME-Version: 1.0 X-Outbound-Client-TLS: VERIFIED;sjc-ads-7310.cisco.com [10.30.220.95];TLSv1.3;TLS_AES_256_GCM_SHA384;256;ciscoit-managed-infra-smtp-auth.cisco.com X-Outbound-SMTP-Client: 10.30.220.95, sjc-ads-7310.cisco.com X-Outbound-Node: aer-l-core-07.cisco.com List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 06:00:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/132926 This 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 Signed-off-by: Yogita Urade --- .../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 diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch new file mode 100644 index 0000000000..86900be690 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p1.patch @@ -0,0 +1,105 @@ +From 5d91cc66a3591faba758a80a1479e0103602facc Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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) diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch new file mode 100644 index 0000000000..d5a35f6a00 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p2.patch @@ -0,0 +1,286 @@ +From 073ba878c6c07d569cb61abc5ae76d46eff1b529 Mon Sep 17 00:00:00 2001 +From: arkmarta +Date: Fri, 31 Jul 2026 14:41:59 +0200 +Subject: [PATCH] conch.telnet: address review, private cap and drop on overflow + +CVE: CVE-2026-115778 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/073ba878c6c07d569cb61abc5ae76d46eff1b529] + +Backport Changes: +- Upstream removes the preceding patch's unannotated + _bufferSubnegotiation(self, b) helper, moving the cap check inline to + dataReceived; no replacement helper signature or typing-only imports are + needed. + +Signed-off-by: Yogita Urade +--- + src/twisted/conch/newsfragments/12706.bugfix | 2 +- + src/twisted/conch/telnet.py | 60 +++++++-- + src/twisted/conch/test/test_telnet.py | 126 +++++++++++++++++-- + 3 files changed, 168 insertions(+), 20 deletions(-) + +diff --git a/src/twisted/conch/newsfragments/12706.bugfix b/src/twisted/conch/newsfragments/12706.bugfix +index 5c9782e64..31ca8f7b9 100644 +--- a/src/twisted/conch/newsfragments/12706.bugfix ++++ b/src/twisted/conch/newsfragments/12706.bugfix +@@ -1 +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. ++twisted.conch.telnet.Telnet.dataReceived 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 d008b354a..8a462a573 100644 +--- a/src/twisted/conch/telnet.py ++++ b/src/twisted/conch/telnet.py +@@ -372,13 +372,29 @@ class Telnet(protocol.Protocol): + should not be made to it. + + @ivar transport: This protocol's transport object. ++ ++ @cvar _MAX_SUBNEGOTIATION_LENGTH: The maximum number of bytes buffered for a ++ single subnegotiation, that is the subnegotiation command byte and its ++ payload between C{IAC SB} and C{IAC SE}. Legitimate subnegotiations ++ carry small option parameters, such as a terminal type (RFC 1091), a ++ window size (RFC 1073, four bytes), or a set of environment variables ++ (RFC 1572), so the default of 4096 is far larger than any real ++ subnegotiation while still bounding the amount of memory a single ++ connection can consume. A peer that sends more than this many bytes ++ without an C{IAC SE} terminator is treated as a protocol violation: the ++ buffer is not grown further, a warning is logged, and the connection is ++ dropped, matching the way L{twisted.protocols.basic.LineReceiver} ++ handles a line that exceeds its C{MAX_LENGTH}. This attribute is ++ private; a subclass that needs a different bound may override it. + """ + ++ _log = Logger() ++ + # One of a lot of things + state = "data" + +- # Cap the per-subnegotiation buffer against an unterminated IAC SB. +- MAX_SUBNEGOTIATION_LENGTH = 4096 ++ # See the class docstring for the rationale behind this bound. ++ _MAX_SUBNEGOTIATION_LENGTH = 4096 + + def __init__(self): + self.options = {} +@@ -520,10 +536,27 @@ 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 _subnegotiationLengthExceeded(self): ++ """ ++ Handle a subnegotiation that reaches L{_MAX_SUBNEGOTIATION_LENGTH} ++ without an C{IAC SE} terminator. ++ ++ A well-behaved peer terminates a subnegotiation with C{IAC SE} long ++ before the cap is reached. A peer that does not is treated as a ++ protocol violation: a warning is logged and the connection is dropped, ++ mirroring L{twisted.protocols.basic.LineReceiver.lineLengthExceeded}, ++ rather than buffering the subnegotiation without bound. The ++ 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: ++ return ++ self._log.warn( ++ "Telnet subnegotiation exceeded {length} bytes without an " ++ "IAC SE terminator; dropping connection.", ++ length=self._MAX_SUBNEGOTIATION_LENGTH, ++ ) ++ self.transport.loseConnection() + + def dataReceived(self, data): + appDataBuffer = [] +@@ -586,8 +619,15 @@ class Telnet(protocol.Protocol): + elif self.state == "subnegotiation": + if b == IAC: + self.state = "subnegotiation-escaped" ++ # The cap is checked inline rather than in a helper to avoid a ++ # Python call per byte on subnegotiation-heavy streams. ++ elif len(self.commands) < self._MAX_SUBNEGOTIATION_LENGTH: ++ self.commands.append(b) + else: +- self._bufferSubnegotiation(b) ++ # Stop parsing; the loop's final flush still delivers any ++ # application data received before the violation. ++ self._subnegotiationLengthExceeded() ++ break + elif self.state == "subnegotiation-escaped": + if b == SE: + self.state = "data" +@@ -599,7 +639,11 @@ class Telnet(protocol.Protocol): + self.negotiate(commands) + else: + self.state = "subnegotiation" +- self._bufferSubnegotiation(b) ++ if len(self.commands) < self._MAX_SUBNEGOTIATION_LENGTH: ++ self.commands.append(b) ++ else: ++ self._subnegotiationLengthExceeded() ++ break + 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 7df22d08a..11a612cdb 100644 +--- a/src/twisted/conch/test/test_telnet.py ++++ b/src/twisted/conch/test/test_telnet.py +@@ -12,6 +12,7 @@ from zope.interface.verify import verifyObject + + from twisted.conch import telnet + from twisted.internet import defer ++from twisted.logger import LogLevel, globalLogPublisher + from twisted.python.compat import iterbytes + from twisted.test import proto_helpers + from twisted.trial import unittest +@@ -263,33 +264,136 @@ 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 ++ def test_boundedSubnegotiationIsDelivered(self): ++ """ ++ A subnegotiation whose payload is within ++ L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} is delivered to the ++ negotiation handler as usual and the connection is left open. ++ """ ++ h = self.p.protocol ++ payload = b"C" * 16 ++ cmd = telnet.IAC + telnet.SB + b"\x12" + payload + telnet.IAC + telnet.SE ++ self.p.dataReceived(cmd) ++ self.assertEqual(h.subcmd, list(iterbytes(payload))) ++ self.assertFalse(self.t.disconnecting) ++ ++ def test_applicationDataBeforeOversizedSubnegotiationIsDelivered(self): ++ """ ++ Application data received before an over-long subnegotiation in the ++ same call is still delivered when the connection is dropped, so valid ++ data received before the protocol violation is not lost. ++ """ ++ h = self.p.protocol ++ cap = telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH ++ self.p.dataReceived( ++ b"hello" + telnet.IAC + telnet.SB + b"\x12" + b"A" * (cap * 2) ++ ) ++ self.assertEqual(h.data, b"hello") ++ self.assertTrue(self.t.disconnecting) ++ ++ def test_oversizedSubnegotiationDropsConnection(self): ++ """ ++ A subnegotiation whose payload reaches ++ L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} without an C{IAC SE} ++ terminator is a protocol violation: the buffer stops growing at the ++ cap and the connection is dropped rather than exhausting memory. ++ Further subnegotiation payload that arrives after the cap is discarded ++ without growing the buffer, so a peer cannot keep buffering. ++ """ ++ cap = telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH + self.p.dataReceived(telnet.IAC + telnet.SB + b"\x12") + self.p.dataReceived(b"A" * (cap * 4)) ++ self.assertTrue(self.t.disconnecting) ++ self.assertEqual(len(self.p.commands), cap) ++ self.p.dataReceived(b"A" * 16) + 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. ++ def test_oversizedSubnegotiationIsNotDelivered(self): ++ """ ++ An over-long subnegotiation is dropped rather than delivered truncated: ++ the negotiation handler is never invoked and the connection is dropped. ++ """ + h = self.p.protocol +- cap = telnet.Telnet.MAX_SUBNEGOTIATION_LENGTH ++ # A distinguishable sentinel, so the assertion proves the handler was ++ # never called rather than merely matching the default empty payload. ++ h.subcmd = "UNSET" ++ 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) ++ self.assertEqual(h.subcmd, "UNSET") ++ self.assertTrue(self.t.disconnecting) + + def test_subnegotiationEscapedBytesCountTowardCap(self): +- # IAC-escaped bytes (IAC IAC) also count toward the cap. +- cap = telnet.Telnet.MAX_SUBNEGOTIATION_LENGTH ++ """ ++ Bytes delivered as an escaped C{IAC IAC} inside a subnegotiation count ++ toward L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH}, so a flood of them ++ also stops at the cap and drops the connection. ++ """ ++ 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.assertTrue(self.t.disconnecting) + self.assertEqual(len(self.p.commands), cap) ++ ++ def test_subnegotiationAtCapIsDelivered(self): ++ """ ++ A properly terminated subnegotiation that fills the buffer to exactly ++ L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} is delivered, so the cap ++ does not reject a legitimate maximum-size subnegotiation. ++ """ ++ h = self.p.protocol ++ cap = telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH ++ # One command byte plus (cap - 1) payload bytes fills the buffer to cap. ++ payload = b"D" * (cap - 1) ++ cmd = telnet.IAC + telnet.SB + b"\x12" + payload + telnet.IAC + telnet.SE ++ self.p.dataReceived(cmd) ++ self.assertEqual(h.subcmd, list(iterbytes(payload))) + self.assertFalse(self.t.disconnecting) + ++ def test_capResetsPerSubnegotiation(self): ++ """ ++ The cap is per subnegotiation: several separately terminated, ++ under-cap subnegotiations in a row are each delivered and the ++ connection stays open. ++ """ ++ h = self.p.protocol ++ one = telnet.IAC + telnet.SB + b"\x12" + b"E" * 32 + telnet.IAC + telnet.SE ++ for _ in range(2000): ++ self.p.dataReceived(one) ++ self.assertEqual(h.subcmd, list(iterbytes(b"E" * 32))) ++ self.assertFalse(self.t.disconnecting) ++ ++ def test_oversizedSubnegotiationLogsAndDropsOnce(self): ++ """ ++ Reaching the cap logs a single warning and drops the connection once, ++ even when further subnegotiation payload keeps arriving afterwards. ++ """ ++ cap = telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH ++ events = [] ++ globalLogPublisher.addObserver(events.append) ++ self.addCleanup(globalLogPublisher.removeObserver, events.append) ++ drops = [] ++ original = self.t.loseConnection ++ ++ def countingLoseConnection(): ++ drops.append(None) ++ original() ++ ++ self.t.loseConnection = countingLoseConnection ++ self.p.dataReceived(telnet.IAC + telnet.SB + b"\x12") ++ self.p.dataReceived(b"A" * (cap * 4)) ++ self.p.dataReceived(b"A" * 128) ++ warnings = [ ++ e ++ for e in events ++ if e.get("log_level") is LogLevel.warn ++ and "subnegotiation" in (e.get("log_format") or "") ++ ] ++ self.assertEqual(len(warnings), 1) ++ self.assertEqual(len(drops), 1) ++ + def _enabledHelper(self, o, eL=[], eR=[], dL=[], dR=[]): + self.assertEqual(o.enabledLocal, eL) + self.assertEqual(o.enabledRemote, eR) diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch new file mode 100644 index 0000000000..23d9f7b835 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p3.patch @@ -0,0 +1,108 @@ +From 306985969879a8aeab811e9730b3d0e54ff372e8 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Mon, 17 Aug 2026 09:37:00 +0100 +Subject: [PATCH] Apply suggestions from code review + +add type annotation + +Co-authored-by: Glyph +Co-authored-by: Adi Roiban + +CVE: CVE-2026-115778 +Upstream-Status: Backport [https://github.com/twisted/twisted/commit/306985969879a8aeab811e9730b3d0e54ff372e8] + +Signed-off-by: Yogita Urade +--- + src/twisted/conch/telnet.py | 2 +- + src/twisted/conch/test/test_telnet.py | 16 ++++++++-------- + 2 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/src/twisted/conch/telnet.py b/src/twisted/conch/telnet.py +index 8a462a573..6dbb65c9e 100644 +--- a/src/twisted/conch/telnet.py ++++ b/src/twisted/conch/telnet.py +@@ -536,7 +536,7 @@ class Telnet(protocol.Protocol): + data = data.replace(IAC, IAC * 2) + self._write(IAC + SB + about + data + IAC + SE) + +- def _subnegotiationLengthExceeded(self): ++ def _subnegotiationLengthExceeded(self) -> None: + """ + Handle a subnegotiation that reaches L{_MAX_SUBNEGOTIATION_LENGTH} + without an C{IAC SE} terminator. +diff --git a/src/twisted/conch/test/test_telnet.py b/src/twisted/conch/test/test_telnet.py +index 11a612cdb..48ae4ccf9 100644 +--- a/src/twisted/conch/test/test_telnet.py ++++ b/src/twisted/conch/test/test_telnet.py +@@ -264,7 +264,7 @@ 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_boundedSubnegotiationIsDelivered(self): ++ def test_boundedSubnegotiationIsDelivered(self) -> None: + """ + A subnegotiation whose payload is within + L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} is delivered to the +@@ -277,7 +277,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.subcmd, list(iterbytes(payload))) + self.assertFalse(self.t.disconnecting) + +- def test_applicationDataBeforeOversizedSubnegotiationIsDelivered(self): ++ def test_applicationDataBeforeOversizedSubnegotiationIsDelivered(self) -> None: + """ + Application data received before an over-long subnegotiation in the + same call is still delivered when the connection is dropped, so valid +@@ -291,7 +291,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.data, b"hello") + self.assertTrue(self.t.disconnecting) + +- def test_oversizedSubnegotiationDropsConnection(self): ++ def test_oversizedSubnegotiationDropsConnection(self) -> None: + """ + A subnegotiation whose payload reaches + L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} without an C{IAC SE} +@@ -308,7 +308,7 @@ class TelnetTransportTests(unittest.TestCase): + self.p.dataReceived(b"A" * 16) + self.assertEqual(len(self.p.commands), cap) + +- def test_oversizedSubnegotiationIsNotDelivered(self): ++ def test_oversizedSubnegotiationIsNotDelivered(self) -> None: + """ + An over-long subnegotiation is dropped rather than delivered truncated: + the negotiation handler is never invoked and the connection is dropped. +@@ -325,7 +325,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.subcmd, "UNSET") + self.assertTrue(self.t.disconnecting) + +- def test_subnegotiationEscapedBytesCountTowardCap(self): ++ def test_subnegotiationEscapedBytesCountTowardCap(self) -> None: + """ + Bytes delivered as an escaped C{IAC IAC} inside a subnegotiation count + toward L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH}, so a flood of them +@@ -337,7 +337,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertTrue(self.t.disconnecting) + self.assertEqual(len(self.p.commands), cap) + +- def test_subnegotiationAtCapIsDelivered(self): ++ def test_subnegotiationAtCapIsDelivered(self) -> None: + """ + A properly terminated subnegotiation that fills the buffer to exactly + L{telnet.Telnet._MAX_SUBNEGOTIATION_LENGTH} is delivered, so the cap +@@ -352,7 +352,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.subcmd, list(iterbytes(payload))) + self.assertFalse(self.t.disconnecting) + +- def test_capResetsPerSubnegotiation(self): ++ def test_capResetsPerSubnegotiation(self) -> None: + """ + The cap is per subnegotiation: several separately terminated, + under-cap subnegotiations in a row are each delivered and the +@@ -365,7 +365,7 @@ class TelnetTransportTests(unittest.TestCase): + self.assertEqual(h.subcmd, list(iterbytes(b"E" * 32))) + self.assertFalse(self.t.disconnecting) + +- def test_oversizedSubnegotiationLogsAndDropsOnce(self): ++ def test_oversizedSubnegotiationLogsAndDropsOnce(self) -> None: + """ + Reaching the cap logs a single warning and drops the connection once, + even when further subnegotiation payload keeps arriving afterwards. diff --git a/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch new file mode 100644 index 0000000000..59ab21e47e --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-twisted/CVE-2026-115778_p4.patch @@ -0,0 +1,36 @@ +From 1baff09a1d56ca9254a6d6f02005f17a7c53a282 Mon Sep 17 00:00:00 2001 +From: arkmarta +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 +--- + 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 " diff --git a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb index 72dc23e3fb..48deee6fdc 100644 --- a/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb +++ b/meta-python/recipes-devtools/python/python3-twisted_25.5.0.bb @@ -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"