CVE-2022-1941 Overview
CVE-2022-1941 is a parsing vulnerability affecting the MessageSet type in Google Protocol Buffers (protobuf) that can lead to out-of-memory failures and denial of service conditions. The vulnerability exists in both protobuf-cpp and protobuf-python implementations across multiple versions. A specially crafted message containing multiple key-value per elements creates parsing issues that can exhaust system memory, enabling attackers to disrupt services that process unsanitized protobuf input.
Protocol Buffers is Google's language-neutral, platform-neutral extensible mechanism for serializing structured data, widely used in gRPC, microservices architectures, and data interchange. This vulnerability is particularly concerning as protobuf is a foundational component in many enterprise applications and cloud services.
Critical Impact
Services receiving untrusted Protocol Buffer messages are vulnerable to denial of service attacks through memory exhaustion when processing maliciously crafted MessageSet type data.
Affected Products
- Google protobuf-cpp versions prior to and including 3.16.1, 3.17.3, 3.18.2, 3.19.4, 3.20.1, and 3.21.5
- Google protobuf-python versions prior to and including 3.16.1, 3.17.3, 3.18.2, 3.19.4, 3.20.1, and 4.21.5
- Fedora 36 and Fedora 37
- Debian Linux 10.0
Discovery Timeline
- September 22, 2022 - CVE-2022-1941 published to NVD
- November 21, 2024 - Last updated in NVD database
Technical Details for CVE-2022-1941
Vulnerability Analysis
The vulnerability resides in how Protocol Buffers handles the MessageSet wire format during parsing operations. The MessageSet type is an older, less commonly used protobuf feature that allows for a specific message extension format. When parsing messages of this type, the protobuf library does not properly validate or limit resource allocation for messages containing multiple key-value pairs per element.
The parsing logic fails to implement adequate bounds checking on memory allocation requests when processing the specially structured MessageSet data. This allows an attacker to craft a message that, when parsed, triggers excessive memory allocation that can quickly exhaust available system resources.
The attack is network-accessible and requires no authentication or user interaction, making it suitable for remote denial of service attacks against any service that accepts and parses Protocol Buffer messages from untrusted sources.
Root Cause
The root cause is classified as CWE-1286 (Improper Validation of Syntactically Incorrect Input). The protobuf parser does not properly validate the structure and resource requirements of MessageSet type messages before allocating memory. When encountering messages with abnormal key-value pair structures, the parser attempts to allocate memory proportional to the malformed input without implementing proper safeguards against resource exhaustion.
The parsing implementation trusts the message structure to be well-formed and allocates memory based on declared sizes or repeated elements without enforcing reasonable upper bounds or progressive memory usage checks.
Attack Vector
An attacker can exploit this vulnerability by sending a specially crafted Protocol Buffer message to any service that parses protobuf data from untrusted sources. The attack vector is network-based and does not require authentication.
The exploitation scenario involves:
- Identifying a target service that accepts Protocol Buffer encoded messages
- Crafting a malicious MessageSet type message with multiple key-value pairs designed to trigger excessive memory allocation
- Sending the crafted message to the target service
- The service's protobuf parser processes the message, triggering out-of-memory conditions
- The service becomes unresponsive or crashes due to memory exhaustion
This vulnerability is particularly dangerous in microservices environments where protobuf is commonly used for inter-service communication, as a single malicious message could cascade failures across dependent services.
Detection Methods for CVE-2022-1941
Indicators of Compromise
- Unusual memory consumption spikes in services processing Protocol Buffer messages
- Out-of-memory errors or service crashes correlated with incoming protobuf message processing
- Abnormally large or malformed Protocol Buffer messages in network traffic
- Repeated service restarts due to memory exhaustion in protobuf-dependent applications
Detection Strategies
- Monitor memory usage patterns of applications using protobuf libraries for sudden, unexplained growth
- Implement application-level logging to track protobuf message parsing operations and identify anomalies
- Deploy network traffic analysis to detect unusually large or malformed Protocol Buffer messages
- Use software composition analysis (SCA) tools to identify vulnerable protobuf library versions in your codebase
Monitoring Recommendations
- Set up memory threshold alerts for services that process external Protocol Buffer messages
- Implement rate limiting on endpoints that accept protobuf input from untrusted sources
- Enable verbose logging during parsing operations to capture details of messages that cause errors
- Regularly audit dependencies to ensure protobuf libraries are updated to patched versions
How to Mitigate CVE-2022-1941
Immediate Actions Required
- Upgrade protobuf-cpp to versions 3.18.3, 3.19.5, 3.20.2, or 3.21.6
- Upgrade protobuf-python to versions 3.18.3, 3.19.5, 3.20.2, or 4.21.6
- Identify all applications and services using Protocol Buffers libraries in your environment
- Apply operating system vendor patches for Fedora and Debian systems
- Implement input validation and size limits on protobuf messages from untrusted sources
Patch Information
Google has released patched versions of Protocol Buffers addressing this vulnerability. The recommended upgrade paths are:
For protobuf-cpp: Upgrade to 3.18.3, 3.19.5, 3.20.2, or 3.21.6 depending on your current version line.
For protobuf-python: Upgrade to 3.18.3, 3.19.5, 3.20.2, or 4.21.6 depending on your current version line.
Note that versions 3.16.x and 3.17.x are no longer receiving updates. Users on these version lines must migrate to a supported version to receive the security fix.
For detailed information, refer to the GitHub Security Advisory GHSA-8gq9-2x98-w8hf and the Google Cloud Security Bulletin.
Workarounds
- Implement message size limits at the application or network layer to reject abnormally large protobuf messages before parsing
- Add memory limits and resource quotas to services processing untrusted protobuf input
- Validate protobuf messages against expected schemas before full parsing when possible
- Consider isolating protobuf parsing operations in sandboxed environments with strict resource constraints
# Example: Setting memory limits for a service using systemd
# Edit the service unit file to add memory constraints
[Service]
MemoryLimit=512M
MemoryHigh=400M
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


