new file mode 100644
@@ -0,0 +1,95 @@
+From 5365f362e56136484c75d010a4c3e6cdb03378f7 Mon Sep 17 00:00:00 2001
+From: zayeem shaikh <zayeem@bugqore.com>
+Date: Wed, 14 Oct 2026 16:45:55 +0530
+Subject: [PATCH] reject whitespace between header name and colon in asgi
+ PythonProtocol
+
+CVE: CVE-2026-134820
+Upstream-Status: Backport [https://github.com/benoitc/gunicorn/commit/6f4c2193a7f68106c88635933c2be5772fae1f3d]
+
+Signed-off-by: Bansi Raychura <braychur@cisco.com>
+---
+ gunicorn/asgi/parser.py | 10 ++++++-
+ tests/test_asgi_parser_validation.py | 41 ++++++++++++++++++++++++++++
+ 2 files changed, 50 insertions(+), 1 deletion(-)
+
+diff --git a/gunicorn/asgi/parser.py b/gunicorn/asgi/parser.py
+index 716d70b..7240fad 100644
+--- a/gunicorn/asgi/parser.py
++++ b/gunicorn/asgi/parser.py
+@@ -512,7 +512,15 @@ class PythonProtocol:
+ if colon == -1:
+ raise InvalidHeader("Missing colon in header")
+
+- name = line[:colon].strip()
++ # RFC 9112 section 5.1: no whitespace is allowed between the field
++ # name and the colon, and a server must reject a message that has
++ # it. Do not strip the name: a stripped "Transfer-Encoding :" or a
++ # leading-space " Content-Length:" would be read as a framing header
++ # here while the WSGI parser (TOKEN_RE) and a well-behaved proxy
++ # reject or fold it, which desyncs the two and smuggles a request.
++ # _is_valid_token already rejects SP/HTAB, so leaving them in place
++ # makes such a name fail validation instead of being accepted.
++ name = line[:colon]
+ if not self._is_valid_token(name):
+ raise InvalidHeaderName(name.decode('latin-1'))
+
+diff --git a/tests/test_asgi_parser_validation.py b/tests/test_asgi_parser_validation.py
+index 48d5d0b..06be6a9 100644
+--- a/tests/test_asgi_parser_validation.py
++++ b/tests/test_asgi_parser_validation.py
+@@ -13,6 +13,7 @@ import pytest
+ from gunicorn.asgi.parser import (
+ PythonProtocol,
+ InvalidHeader,
++ InvalidHeaderName,
+ InvalidChunkSize,
+ UnsupportedTransferCoding,
+ ParseError,
+@@ -416,3 +417,43 @@ class TestMultipleTransferEncodingHeaders:
+ b"Transfer-Encoding: chunked\r\n"
+ b"\r\n"
+ )
++
++
++class TestHeaderNameWhitespace:
++ """Whitespace between field name and colon must be rejected (RFC 9112 5.1)."""
++
++ def test_space_before_colon_rejected(self):
++ """A space before the colon must not be stripped into a valid name."""
++ parser = PythonProtocol()
++
++ with pytest.raises(InvalidHeaderName):
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Transfer-Encoding : chunked\r\n"
++ b"\r\n"
++ )
++
++ def test_tab_before_colon_rejected(self):
++ """A tab before the colon must not be stripped into a valid name."""
++ parser = PythonProtocol()
++
++ with pytest.raises(InvalidHeaderName):
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Content-Length\t: 10\r\n"
++ b"\r\n"
++ )
++
++ def test_leading_whitespace_name_rejected(self):
++ """A leading-space line must not be accepted as a framing header."""
++ parser = PythonProtocol()
++
++ with pytest.raises(InvalidHeaderName):
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b" Content-Length: 10\r\n"
++ b"\r\n"
++ )
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,106 @@
+From 8d8c493dda70a276dad8fa0f3303c794fe0a1e64 Mon Sep 17 00:00:00 2001
+From: aoright <102943475+aoright@users.noreply.github.com>
+Date: Fri, 11 Sep 2026 16:17:51 +0800
+Subject: [PATCH] Fix HTTP request smuggling via unsafe whitespace stripping
+
+CVE: CVE-2026-134820
+Upstream-Status: Backport [https://github.com/benoitc/gunicorn/commit/a284791c0b03d752a6b2e3d1f176c6c80d5f70f2]
+
+Backport Changes:
+- Port the raw-request ASGI and WSGI regression cases from upstream
+ follow-up https://github.com/benoitc/gunicorn/commit/614508e5c4169d32fc294e3745e5bef9ffb52bb7.
+
+Signed-off-by: Bansi Raychura <braychur@cisco.com>
+---
+ gunicorn/asgi/parser.py | 4 ++--
+ gunicorn/http/message.py | 2 +-
+ tests/test_asgi_parser_validation.py | 14 ++++++++++++++
+ tests/test_http.py | 15 +++++++++++++++
+ 4 files changed, 32 insertions(+), 3 deletions(-)
+
+diff --git a/gunicorn/asgi/parser.py b/gunicorn/asgi/parser.py
+index 7240fad..38fc38c 100644
+--- a/gunicorn/asgi/parser.py
++++ b/gunicorn/asgi/parser.py
+@@ -524,7 +524,7 @@ class PythonProtocol:
+ if not self._is_valid_token(name):
+ raise InvalidHeaderName(name.decode('latin-1'))
+
+- value = line[colon + 1:].strip()
++ value = line[colon + 1:].strip(b" \t")
+ if self._has_invalid_header_chars(value):
+ raise InvalidHeader("Invalid characters in header value")
+
+@@ -567,7 +567,7 @@ class PythonProtocol:
+ elif name == b'transfer-encoding':
+ # Properly parse comma-separated Transfer-Encoding values
+ # per RFC 9112 Section 6.1
+- vals = [v.strip() for v in value.split(b',')]
++ vals = [v.strip(b" \t") for v in value.split(b',')]
+ for val in vals:
+ val_lower = val.lower()
+ if val_lower == b'chunked':
+diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py
+index 853c70a..0dfb089 100644
+--- a/gunicorn/http/message.py
++++ b/gunicorn/http/message.py
+@@ -317,7 +317,7 @@ class Message:
+ elif name == "TRANSFER-ENCODING":
+ # T-E can be a list
+ # https://datatracker.ietf.org/doc/html/rfc9112#name-transfer-encoding
+- vals = [v.strip() for v in value.split(',')]
++ vals = [v.strip(" \t") for v in value.split(',')]
+ for val in vals:
+ if val.lower() == "chunked":
+ # DANGER: transfer codings stack, and stacked chunking is never intended
+diff --git a/tests/test_asgi_parser_validation.py b/tests/test_asgi_parser_validation.py
+index 06be6a9..0d80540 100644
+--- a/tests/test_asgi_parser_validation.py
++++ b/tests/test_asgi_parser_validation.py
+@@ -149,6 +149,20 @@ class TestChunkedInHTTP10:
+ class TestTransferEncodingValidation:
+ """Test proper validation of Transfer-Encoding header values."""
+
++ @pytest.mark.parametrize("ws", [b"\x0b", b"\x0c", b"\x85", b"\xa0"])
++ def test_non_http_whitespace_rejected(self, ws):
++ """Only SP/HTAB are whitespace around Transfer-Encoding tokens."""
++ parser = PythonProtocol()
++
++ with pytest.raises(ParseError):
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Transfer-Encoding: chunked" + ws + b"\r\n"
++ b"\r\n"
++ b"0\r\n\r\n"
++ )
++
+ def test_stacked_chunked_rejected(self):
+ """Stacked chunked encoding must be rejected."""
+ parser = PythonProtocol()
+diff --git a/tests/test_http.py b/tests/test_http.py
+index ef9b5ea..b690645 100644
+--- a/tests/test_http.py
++++ b/tests/test_http.py
+@@ -277,3 +277,18 @@ def test_file_wrapper_iterable():
+ wrapper2 = FileWrapper(filelike2, blksize=2)
+ chunks = list(wrapper2)
+ assert chunks == [b"ab", b"c"]
++
++
++@pytest.mark.parametrize("ws", [b"\x0b", b"\x0c", b"\x85", b"\xa0"])
++def test_transfer_encoding_non_http_whitespace_rejected(ws):
++ """Only SP/HTAB are whitespace around Transfer-Encoding tokens."""
++ from gunicorn.config import Config
++ from gunicorn.http.errors import UnsupportedTransferCoding
++ from gunicorn.http.parser import RequestParser
++
++ cfg = Config()
++ cfg.set('http_parser', 'python')
++ data = (b"POST / HTTP/1.1\r\nHost: x\r\nTransfer-Encoding: chunked" + ws
++ + b"\r\n\r\n0\r\n\r\n")
++ with pytest.raises((InvalidHeader, UnsupportedTransferCoding)):
++ next(RequestParser(cfg, [data], None))
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,79 @@
+From 6bc671b7c10898decdd0fe42e22271e529916756 Mon Sep 17 00:00:00 2001
+From: zayeem shaikh <zayeem@bugqore.com>
+Date: Tue, 6 Oct 2026 10:06:13 +0530
+Subject: [PATCH] require digits only in Content-Length in the asgi python
+ parser
+
+CVE: CVE-2026-134820
+Upstream-Status: Backport [https://github.com/benoitc/gunicorn/commit/400f5ec95abf3aac0f1f0f0bc9a6a001660085c4]
+
+Backport Changes:
+- Retain 25.3.0's ValueError-to-InvalidHeader handling after the digit
+ check so conversion failures remain parser errors.
+
+Signed-off-by: Bansi Raychura <braychur@cisco.com>
+---
+ gunicorn/asgi/parser.py | 10 ++++++----
+ tests/test_asgi_parser_validation.py | 15 ++++++++++++++-
+ 2 files changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/gunicorn/asgi/parser.py b/gunicorn/asgi/parser.py
+index 38fc38c..8ba4774 100644
+--- a/gunicorn/asgi/parser.py
++++ b/gunicorn/asgi/parser.py
+@@ -556,13 +556,15 @@ class PythonProtocol:
+ # Reject duplicate Content-Length headers (request smuggling vector)
+ if content_length is not None:
+ raise InvalidHeader("Duplicate Content-Length header")
++ # RFC 9110 section 8.6: Content-Length = 1*DIGIT. int() on
++ # its own also takes a sign and underscores, which a proxy
++ # framing by the same header will not.
++ if not value.isdigit():
++ raise InvalidHeader("Invalid Content-Length value")
+ try:
+- cl_value = int(value)
++ content_length = int(value)
+ except ValueError:
+ raise InvalidHeader("Invalid Content-Length value")
+- if cl_value < 0:
+- raise InvalidHeader("Negative Content-Length")
+- content_length = cl_value
+
+ elif name == b'transfer-encoding':
+ # Properly parse comma-separated Transfer-Encoding values
+diff --git a/tests/test_asgi_parser_validation.py b/tests/test_asgi_parser_validation.py
+index 0d80540..6cdfd63 100644
+--- a/tests/test_asgi_parser_validation.py
++++ b/tests/test_asgi_parser_validation.py
+@@ -97,7 +97,7 @@ class TestDuplicateContentLength:
+ """Negative Content-Length must be rejected."""
+ parser = PythonProtocol()
+
+- with pytest.raises(InvalidHeader, match="Negative Content-Length"):
++ with pytest.raises(InvalidHeader, match="Invalid Content-Length"):
+ parser.feed(
+ b"POST /test HTTP/1.1\r\n"
+ b"Host: localhost\r\n"
+@@ -105,6 +105,19 @@ class TestDuplicateContentLength:
+ b"\r\n"
+ )
+
++ @pytest.mark.parametrize("value", [b"+5", b"1_0"])
++ def test_non_digit_cl_rejected(self, value):
++ """Content-Length is 1*DIGIT; forms int() alone would take are rejected."""
++ parser = PythonProtocol()
++
++ with pytest.raises(InvalidHeader, match="Invalid Content-Length"):
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Content-Length: " + value + b"\r\n"
++ b"\r\n"
++ )
++
+ def test_non_numeric_cl_rejected(self):
+ """Non-numeric Content-Length must be rejected."""
+ parser = PythonProtocol()
+--
+2.35.6
+
new file mode 100644
@@ -0,0 +1,112 @@
+From f495dbe6c6f2aeb4c50d8eec3f92d8378e851943 Mon Sep 17 00:00:00 2001
+From: zayeem shaikh <zayeem@bugqore.com>
+Date: Thu, 8 Oct 2026 22:07:26 +0530
+Subject: [PATCH] validate chunk data terminator is CRLF in PythonProtocol
+
+CVE: CVE-2026-134820
+Upstream-Status: Backport [https://github.com/benoitc/gunicorn/commit/8e00028d37261500557c04ceb68ae7de01f56a28]
+
+Signed-off-by: Bansi Raychura <braychur@cisco.com>
+---
+ gunicorn/asgi/parser.py | 12 +++++++-
+ tests/test_asgi_parser_validation.py | 45 ++++++++++++++++++++++++++++
+ 2 files changed, 56 insertions(+), 1 deletion(-)
+
+diff --git a/gunicorn/asgi/parser.py b/gunicorn/asgi/parser.py
+index 8ba4774..ed0ff4c 100644
+--- a/gunicorn/asgi/parser.py
++++ b/gunicorn/asgi/parser.py
+@@ -90,6 +90,10 @@ class InvalidChunkExtension(ParseError):
+ """Invalid chunk extension per RFC 9112."""
+
+
++class ChunkMissingTerminator(ParseError):
++ """Chunk data not followed by the required CRLF per RFC 9112."""
++
++
+ class PythonProtocol:
+ """Callback-based HTTP/1.1 parser (pure Python fallback).
+
+@@ -732,9 +736,15 @@ class PythonProtocol:
+ self._chunk_state = 'crlf'
+
+ elif self._chunk_state == 'crlf':
+- # Skip CRLF after chunk data
++ # RFC 9112 7.1: chunk-data is terminated by CRLF. Accepting
++ # anything else here lets a peer frame the body one way while a
++ # strict upstream frames it another (request smuggling vector),
++ # so the two bytes must be exactly CRLF.
+ if len(self._buffer) < 2:
+ return False
++ if self._buffer[:2] != b'\r\n':
++ raise ChunkMissingTerminator(
++ "chunk data not terminated by CRLF")
+ del self._buffer[:2] # Skip \r\n
+ self._chunk_state = 'size'
+
+diff --git a/tests/test_asgi_parser_validation.py b/tests/test_asgi_parser_validation.py
+index 6cdfd63..912aced 100644
+--- a/tests/test_asgi_parser_validation.py
++++ b/tests/test_asgi_parser_validation.py
+@@ -15,6 +15,7 @@ from gunicorn.asgi.parser import (
+ InvalidHeader,
+ InvalidHeaderName,
+ InvalidChunkSize,
++ ChunkMissingTerminator,
+ UnsupportedTransferCoding,
+ ParseError,
+ )
+@@ -409,6 +410,50 @@ class TestChunkSizeValidation:
+ assert b"".join(body_chunks) == b"hello"
+
+
++class TestChunkTerminator:
++ """Test strict validation of the CRLF that terminates chunk data."""
++
++ def test_bad_chunk_terminator_rejected(self):
++ """Non-CRLF bytes after chunk data must be rejected, not skipped."""
++ body_chunks = []
++ parser = PythonProtocol(
++ on_body=lambda chunk: body_chunks.append(chunk),
++ )
++
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Transfer-Encoding: chunked\r\n"
++ b"\r\n"
++ )
++
++ # "hello" is 5 bytes, followed by "XX" instead of CRLF. A lax parser
++ # would treat "XX" as the terminator and keep reading "3\r\nABC..."
++ # as a second chunk, framing the body differently from a strict peer.
++ with pytest.raises(ChunkMissingTerminator):
++ parser.feed(b"5\r\nhelloXX3\r\nABC\r\n0\r\n\r\n")
++
++ def test_valid_chunk_terminator_accepted(self):
++ """A proper CRLF terminator between chunks still works."""
++ body_chunks = []
++ parser = PythonProtocol(
++ on_body=lambda chunk: body_chunks.append(chunk),
++ )
++
++ parser.feed(
++ b"POST /test HTTP/1.1\r\n"
++ b"Host: localhost\r\n"
++ b"Transfer-Encoding: chunked\r\n"
++ b"\r\n"
++ b"5\r\nhello\r\n"
++ b"3\r\nABC\r\n"
++ b"0\r\n\r\n"
++ )
++
++ assert parser.is_complete
++ assert b"".join(body_chunks) == b"helloABC"
++
++
+ class TestMultipleTransferEncodingHeaders:
+ """Test handling of multiple Transfer-Encoding headers."""
+
+--
+2.35.6
+
@@ -11,6 +11,10 @@ CVE_PRODUCT = "gunicorn"
SRC_URI += " \
file://run-ptest \
+ file://CVE-2026-134820_p1.patch \
+ file://CVE-2026-134820_p2.patch \
+ file://CVE-2026-134820_p3.patch \
+ file://CVE-2026-134820_p4.patch \
"
# python-misc for wsgiref
Backport the four Gunicorn 27.0.0 fixes for CVE-2026-134820 to 25.3.0. References [1] through [4] are in patch application order. NVD [5] lists [1], [3], and [4] and links to upstream PR [6]. That PR also contains [2], which tightens HTTP whitespace normalization in the Python ASGI and WSGI parsers. Gunicorn 25.3.0 contains the affected normalization, so [2] is needed for the full framing fix. It is also the immediate upstream parent of [3]. The python3-gunicorn package built successfully with this patch, and its ptest suite passed. [1] https://github.com/benoitc/gunicorn/commit/6f4c2193a7f68106c88635933c2be5772fae1f3d [2] https://github.com/benoitc/gunicorn/commit/a284791c0b03d752a6b2e3d1f176c6c80d5f70f2 [3] https://github.com/benoitc/gunicorn/commit/400f5ec95abf3aac0f1f0f0bc9a6a001660085c4 [4] https://github.com/benoitc/gunicorn/commit/8e00028d37261500557c04ceb68ae7de01f56a28 [5] https://nvd.nist.gov/vuln/detail/CVE-2026-134820 [6] https://github.com/benoitc/gunicorn/pull/3786 Signed-off-by: Bansi Raychura <braychur@cisco.com> --- .../python3-gunicorn/CVE-2026-134820_p1.patch | 95 +++++++++++++++ .../python3-gunicorn/CVE-2026-134820_p2.patch | 106 +++++++++++++++++ .../python3-gunicorn/CVE-2026-134820_p3.patch | 79 ++++++++++++ .../python3-gunicorn/CVE-2026-134820_p4.patch | 112 ++++++++++++++++++ .../python/python3-gunicorn_25.3.0.bb | 4 + 5 files changed, 396 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-gunicorn/CVE-2026-134820_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-gunicorn/CVE-2026-134820_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-gunicorn/CVE-2026-134820_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-gunicorn/CVE-2026-134820_p4.patch