python3-cbor2: Fix CVE-2026-26209
PATCH 1/1 python3-cbor2: Fix CVE-2026-26209
From: Devansh Patel <[email protected]>
Scarthgap already contains 4810cd8c5bbc [3], which backports fb4ee161 and e61a5f36 for read-ahead/read-size handling. The associated submission [4] labels that work as CVE-2026-26209, but it does not add the max_depth protection required for uncontrolled recursion [2].
Complete the existing backport with the 5.9.0 max-depth chain:
- bcb6cea4: add the C decoder depth limit [1]
- 94e0d212: add the security-essential pure-Python depth limit
- 53521e7c: apply the required type correction
- a7ac10d5: raise the default depth limit to 400
- d903d62c: synchronize the C function signature default
The 5.9.0 upgrade description [5] also identifies max_depth as the CVE fix. Full upstream commit links are recorded in the embedded patch headers.
[1] https://github.com/agronholm/cbor2/commit/bcb6cea4edde1d00ff4f0eece883dea951f66e1b
[2] https://github.com/advisories/GHSA-3c37-wwvx-h642
[3] https://git.openembedded.org/meta-openembedded/commit/?id=4810cd8c5bbc0b4349a78eac85a6a882bc0b03a2
[4] https://www.mail-archive.com/openembedded-devel%40lists.openembedded.org/msg105607.html
[5] https://www.mail-archive.com/openembedded-devel%40lists.openembedded.org/msg105418.html
--- .../CVE-2026-26209-dependent.patch | 27 ++ .../python3-cbor2/CVE-2026-26209_p1.patch | 173 +++++++ .../python3-cbor2/CVE-2026-26209_p2.patch | 435 ++++++++++++++++++ .../python3-cbor2/CVE-2026-26209_p3.patch | 81 ++++ .../python3-cbor2/CVE-2026-26209_p4.patch | 28 ++ .../python/python3-cbor2_5.6.4.bb | 5 + 6 files changed, 749 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209-dependent.patch create mode 100644 meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p1.patch create mode 100644 meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p2.patch create mode 100644 meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p3.patch create mode 100644 meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p4.patch
meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209-dependent.patch new file +27 -0
@@ -0,0 +1,27 @@ +From d4213ba74d2bf8039f7f062b49955d37a0f4ec02 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= <[email protected]> +Date: Tue, 3 Mar 2026 01:26:17 +0200 +Subject: [PATCH] Fixed ssize_t to Py_ssize_t + +CVE: CVE-2026-26209 +Upstream-Status: Backport [https://github.com/agronholm/cbor2/commit/53521e7ca96c7a19f8a529fe59ef566212a24b3f] + +(cherry picked from commit 53521e7ca96c7a19f8a529fe59ef566212a24b3f) +Signed-off-by: Devansh Patel <[email protected]> +--- + source/decoder.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/decoder.h b/source/decoder.h +index 4536a4a..c4ef1c1 100644 +--- a/source/decoder.h ++++ b/source/decoder.h +@@ -22,7 +22,7 @@ typedef struct CBORDecoderObject_ { + PyObject *shareables; + PyObject *stringref_namespace; + PyObject *str_errors; +- ssize_t max_depth; ++ Py_ssize_t max_depth; + bool immutable; + Py_ssize_t shared_index; + Py_ssize_t decode_depth;
meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p1.patch new file +173 -0
173 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p2.patch new file +435 -0
435 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p3.patch new file +81 -0
81 lines not on this page · raw message
meta-python/recipes-devtools/python/python3-cbor2/CVE-2026-26209_p4.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 83317379cb68b0caafae35f374e40d95eec106b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= <[email protected]> +Date: Sun, 22 Mar 2026 17:26:27 +0200 +Subject: [PATCH] Updated the max_depth default value in the C function + signature + +CVE: CVE-2026-26209 +Upstream-Status: Backport [https://github.com/agronholm/cbor2/commit/d903d62c86de118e8abe626596f9be7b98ac44e9] + +(cherry picked from commit d903d62c86de118e8abe626596f9be7b98ac44e9) +Signed-off-by: Devansh Patel <[email protected]> +--- + source/decoder.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/decoder.c b/source/decoder.c +index 04c9142..3ce2545 100644 +--- a/source/decoder.c ++++ b/source/decoder.c +@@ -170,7 +170,7 @@ error: + + + // CBORDecoder.__init__(self, fp=None, tag_hook=None, object_hook=None, +-// str_errors='strict', read_size=1, *, max_depth=100) ++// str_errors='strict', read_size=1, *, max_depth=400) + int + CBORDecoder_init(CBORDecoderObject *self, PyObject *args, PyObject *kwargs) + {
meta-python/recipes-devtools/python/python3-cbor2_5.6.4.bb +5 -0
@@ -16,6 +16,11 @@ SRC_URI += " \ file://CVE-2025-68131.patch \ file://CVE-2026-26209-pre1.patch \ file://CVE-2026-26209.patch \ + file://CVE-2026-26209_p1.patch \ + file://CVE-2026-26209_p2.patch \ + file://CVE-2026-26209-dependent.patch \ + file://CVE-2026-26209_p3.patch \ + file://CVE-2026-26209_p4.patch \ " RDEPENDS:${PN}-ptest += " \
Signature · 1 line
2.35.6