Skip to content

Commit 7c554bf

Browse files
CBL-Mariner-Botazurelinux-securitydurgajagadeesh
authored
Merge PR "[AUTO-CHERRYPICK] [AutoPR- Security] Patch protobuf for CVE-2026-0994 [HIGH] - branch main" #15929
Co-authored-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> Co-authored-by: Durga Jagadeesh Palli <v-dpalli@microsoft.com>
1 parent 324fab4 commit 7c554bf

File tree

2 files changed

+75
-1
lines changed

2 files changed

+75
-1
lines changed

SPECS/protobuf/CVE-2026-0994.patch

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From f66ef5e56b331a5367c0d6dd77de552f5cc04eac Mon Sep 17 00:00:00 2001
2+
From: AllSpark <allspark@microsoft.com>
3+
Date: Fri, 6 Feb 2026 10:02:21 +0000
4+
Subject: [PATCH] python: Fix Any recursion depth bypass by routing WKT parsing
5+
through ConvertMessage in _ConvertAnyMessage
6+
7+
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
8+
Upstream-reference: AI Backport of https://github.com/protocolbuffers/protobuf/pull/25586.patch
9+
---
10+
python/google/protobuf/json_format.py | 21 ++++++++++++++++++---
11+
1 file changed, 18 insertions(+), 3 deletions(-)
12+
13+
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
14+
index 965614d..35c9b0b 100644
15+
--- a/python/google/protobuf/json_format.py
16+
+++ b/python/google/protobuf/json_format.py
17+
@@ -461,9 +461,11 @@ _INT_OR_FLOAT = six.integer_types + (float,)
18+
class _Parser(object):
19+
"""JSON format parser for protocol message."""
20+
21+
- def __init__(self, ignore_unknown_fields, descriptor_pool):
22+
+ def __init__(self, ignore_unknown_fields, descriptor_pool, max_recursion_depth=100):
23+
self.ignore_unknown_fields = ignore_unknown_fields
24+
self.descriptor_pool = descriptor_pool
25+
+ self.max_recursion_depth = max_recursion_depth
26+
+ self.recursion_depth = 0
27+
28+
def ConvertMessage(self, value, message):
29+
"""Convert a JSON object into a message.
30+
@@ -475,6 +477,17 @@ class _Parser(object):
31+
Raises:
32+
ParseError: In case of convert problems.
33+
"""
34+
+ # Increment recursion depth at message entry. The max_recursion_depth limit
35+
+ # is exclusive: a depth value equal to max_recursion_depth will trigger an
36+
+ # error. For example, with max_recursion_depth=5, nesting up to depth 4 is
37+
+ # allowed, but attempting depth 5 raises ParseError.
38+
+ self.recursion_depth += 1
39+
+ if self.recursion_depth > self.max_recursion_depth:
40+
+ raise ParseError(
41+
+ 'Message too deep. Max recursion depth is {0}'.format(
42+
+ self.max_recursion_depth
43+
+ )
44+
+ )
45+
message_descriptor = message.DESCRIPTOR
46+
full_name = message_descriptor.full_name
47+
if _IsWrapperMessage(message_descriptor):
48+
@@ -483,6 +496,7 @@ class _Parser(object):
49+
methodcaller(_WKTJSONMETHODS[full_name][1], value, message)(self)
50+
else:
51+
self._ConvertFieldValuePair(value, message)
52+
+ self.recursion_depth -= 1
53+
54+
def _ConvertFieldValuePair(self, js, message):
55+
"""Convert field value pairs into regular message.
56+
@@ -617,8 +631,9 @@ class _Parser(object):
57+
if _IsWrapperMessage(message_descriptor):
58+
self._ConvertWrapperMessage(value['value'], sub_message)
59+
elif full_name in _WKTJSONMETHODS:
60+
- methodcaller(
61+
- _WKTJSONMETHODS[full_name][1], value['value'], sub_message)(self)
62+
+ # For well-known types (including nested Any), use ConvertMessage
63+
+ # to ensure recursion depth is properly tracked
64+
+ self.ConvertMessage(value['value'], sub_message)
65+
else:
66+
del value['@type']
67+
self._ConvertFieldValuePair(value, sub_message)
68+
--
69+
2.45.4
70+

SPECS/protobuf/protobuf.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Google's data interchange format
22
Name: protobuf
33
Version: 3.17.3
4-
Release: 4%{?dist}
4+
Release: 5%{?dist}
55
License: BSD
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -10,6 +10,7 @@ URL: https://developers.google.com/protocol-buffers/
1010
Source0: https://github.com/protocolbuffers/protobuf/releases/download/v%{version}/%{name}-all-%{version}.tar.gz
1111
Patch0: CVE-2022-1941.patch
1212
Patch1: CVE-2025-4565.patch
13+
Patch2: CVE-2026-0994.patch
1314
BuildRequires: curl
1415
BuildRequires: libstdc++
1516
BuildRequires: make
@@ -110,6 +111,9 @@ popd
110111
%{python3_sitelib}/*
111112

112113
%changelog
114+
* Fri Feb 06 2026 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 3.17.3-5
115+
- Patch for CVE-2026-0994
116+
113117
* Tue Jul 22 2025 Akhila Guruju <v-guakhila@microsoft.com> - 3.17.3-4
114118
- Patch CVE-2025-4565
115119

0 commit comments

Comments
 (0)