new file mode 100644
@@ -0,0 +1,83 @@
+From ab4953f1262636343bcc1875117f7a8c93d10509 Mon Sep 17 00:00:00 2001
+From: R0ck3t <118608719+zhangyan8216@users.noreply.github.com>
+Date: Tue, 6 Oct 2026 21:33:54 +0800
+Subject: [PATCH] set_cookie: normalize max_age through int() to prevent cookie attribute injection
+
+The max_age parameter was assigned to the cookie Morsel outside the
+attribute-allowlist validation loops (added for CVE-2026-35536 and
+CVE-2026-91991), so a non-int max_age containing ";" would inject
+arbitrary cookie attributes into the Set-Cookie header verbatim.
+Normalizing through int() rejects such values.
+
+Refs GHSA-c6v4-qj2h-f748
+
+CVE: CVE-2026-123535
+Upstream-Status: Backport [https://github.com/tornadoweb/tornado/commit/ab4953f1262636343bcc1875117f7a8c93d10509]
+
+Signed-off-by: Yogita Urade <yurade@cisco.com>
+---
+ tornado/test/web_test.py | 20 ++++++++++++++++++++
+ tornado/web.py | 5 ++++-
+ 2 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
+index 0dba44a7..1a718488 100644
+--- a/tornado/test/web_test.py
++++ b/tornado/test/web_test.py
+@@ -381,6 +381,16 @@ class CookieTest(WebTestCase):
+ def get(self):
+ self.set_cookie("foo", "bar", max_age=10)
+
++ class SetCookieMaxAgeSanitizedHandler(RequestHandler):
++ def get(self):
++ # A non-int max_age (e.g. an attacker-controlled string
++ # containing cookie attributes) is rejected instead of being
++ # written into the Set-Cookie header verbatim.
++ try:
++ self.set_cookie("foo", "bar", max_age="86400; Path=/evil")
++ except ValueError:
++ self.set_status(400)
++
+ class SetCookieExpiresDaysHandler(RequestHandler):
+ def get(self):
+ self.set_cookie("foo", "bar", expires_days=10)
+@@ -405,6 +415,7 @@ class CookieTest(WebTestCase):
+ ("/forbidden_char", SetCookieForbiddenCharHandler),
+ ("/set_overwrite", SetCookieOverwriteHandler),
+ ("/set_max_age", SetCookieMaxAgeHandler),
++ ("/set_max_age_sanitized", SetCookieMaxAgeSanitizedHandler),
+ ("/set_expires_days", SetCookieExpiresDaysHandler),
+ ("/set_falsy_flags", SetCookieFalsyFlags),
+ ("/set_deprecated", SetCookieDeprecatedArgs),
+@@ -478,6 +489,15 @@ class CookieTest(WebTestCase):
+ headers = response.headers.get_list("Set-Cookie")
+ self.assertEqual(sorted(headers), ["foo=bar; Max-Age=10; Path=/"])
+
++ def test_set_cookie_max_age_sanitized(self):
++ # A max_age that is not a valid int could smuggle extra cookie
++ # attributes past the attribute allowlist (GHSA-c6v4-qj2h-f748);
++ # it must be rejected rather than written to the header verbatim.
++ response = self.fetch("/set_max_age_sanitized")
++ self.assertEqual(response.code, 400)
++ for header in response.headers.get_list("Set-Cookie"):
++ self.assertNotIn("evil", header)
++
+ def test_set_cookie_expires_days(self):
+ response = self.fetch("/set_expires_days")
+ header = response.headers.get("Set-Cookie")
+diff --git a/tornado/web.py b/tornado/web.py
+index a61e9594..277a7bf4 100644
+--- a/tornado/web.py
++++ b/tornado/web.py
+@@ -744,7 +744,10 @@ class RequestHandler:
+ morsel["path"] = path
+ if max_age:
+ # Note change from _ to -.
+- morsel["max-age"] = str(max_age)
++ # Normalize through int() so that a non-int max_age (which could
++ # smuggle extra cookie attributes past the attribute allowlist)
++ # is rejected instead of being written to the header verbatim.
++ morsel["max-age"] = str(int(max_age))
+ if httponly:
+ # Note that SimpleCookie ignores the value here. The presense of an
+ # httponly (or secure) key is treated as true.
new file mode 100644
@@ -0,0 +1,30 @@
+From 1fefc3d3df5146a087a2a879424adaed94f35827 Mon Sep 17 00:00:00 2001
+From: R0ck3t <118608719+zhangyan8216@users.noreply.github.com>
+Date: Tue, 6 Oct 2026 22:22:50 +0800
+Subject: [PATCH] Add type: ignore for intentionally invalid max_age in test
+
+The test deliberately passes a non-int max_age (the injection
+payload from GHSA-c6v4-qj2h-f748), which mypy rightly flags
+against the int | None signature.
+
+CVE: CVE-2026-123535
+Upstream-Status: Backport [https://github.com/tornadoweb/tornado/commit/1fefc3d3df5146a087a2a879424adaed94f35827]
+
+Signed-off-by: Yogita Urade <yurade@cisco.com>
+---
+ tornado/test/web_test.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
+index 1a718488..b3bf971e 100644
+--- a/tornado/test/web_test.py
++++ b/tornado/test/web_test.py
+@@ -387,7 +387,7 @@ class CookieTest(WebTestCase):
+ # containing cookie attributes) is rejected instead of being
+ # written into the Set-Cookie header verbatim.
+ try:
+- self.set_cookie("foo", "bar", max_age="86400; Path=/evil")
++ self.set_cookie("foo", "bar", max_age="86400; Path=/evil") # type: ignore[arg-type]
+ except ValueError:
+ self.set_status(400)
+
new file mode 100644
@@ -0,0 +1,31 @@
+From fb398638efcf023d09282989184c4f97c64982ca Mon Sep 17 00:00:00 2001
+From: R0ck3t <118608719+zhangyan8216@users.noreply.github.com>
+Date: Tue, 6 Oct 2026 23:46:18 +0800
+Subject: [PATCH] Shorten test line to satisfy flake8 E501 (100-char limit)
+
+Same injection payload semantics, shorter string.
+
+CVE: CVE-2026-123535
+Upstream-Status: Backport [https://github.com/tornadoweb/tornado/commit/fb398638efcf023d09282989184c4f97c64982ca]
+
+Signed-off-by: Yogita Urade <yurade@cisco.com>
+---
+ tornado/test/web_test.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
+index f1ec81f2..7a8f5264 100644
+--- a/tornado/test/web_test.py
++++ b/tornado/test/web_test.py
+@@ -388,7 +388,7 @@ class CookieTest(WebTestCase):
+ # containing cookie attributes) is rejected instead of being
+ # written into the Set-Cookie header verbatim.
+ try:
+- self.set_cookie("foo", "bar", max_age="86400; Path=/evil") # type: ignore[arg-type]
++ self.set_cookie("foo", "bar", max_age="1; Path=/x") # type: ignore[arg-type]
+ except ValueError:
+ self.set_status(400)
+
+--
+2.35.6
+
@@ -22,6 +22,9 @@ SRC_URI += "file://CVE-2026-91990.patch \
file://CVE-2026-116578_p1.patch \
file://CVE-2026-116578_p2.patch \
file://CVE-2026-116578_p3.patch \
+ file://CVE-2026-123535_p1.patch \
+ file://CVE-2026-123535_p2.patch \
+ file://CVE-2026-123535_p3.patch \
"
inherit pypi python_setuptools_build_meta
This patch applies the upstream fix as referenced in [4], using the commit shown in [1], [2] and [3]. [1] https://github.com/tornadoweb/tornado/commit/ab4953f1262636343bcc1875117f7a8c93d10509 [2] https://github.com/tornadoweb/tornado/commit/1fefc3d3df5146a087a2a879424adaed94f35827 [3] https://github.com/tornadoweb/tornado/commit/fb398638efcf023d09282989184c4f97c64982ca [4] https://security-tracker.debian.org/tracker/CVE-2026-123535 Signed-off-by: Yogita Urade <yurade@cisco.com> --- .../python3-tornado/CVE-2026-123535_p1.patch | 83 +++++++++++++++++++ .../python3-tornado/CVE-2026-123535_p2.patch | 30 +++++++ .../python3-tornado/CVE-2026-123535_p3.patch | 31 +++++++ .../python/python3-tornado_6.5.7.bb | 3 + 4 files changed, 147 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-tornado/CVE-2026-123535_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-tornado/CVE-2026-123535_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-tornado/CVE-2026-123535_p3.patch