CVE-2022-1941: Protobuf Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-8gq9-2x98-w8hf
CVSS 7.5
CWE-1286 CWE-119
Published
Advisory Summary

CVE-2022-1941 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-1286: Improper Validation of Syntactic Correctness of Input) affecting Protobuf libraries in the PyPI ecosystem. The issue involves protobuf-cpp and protobuf-python have potential denial of service issue. Remediation is available by upgrading affected packages to version 3.18.3, 3.19.5, 3.20.2, 4.21.6.

CVE-2022-1941 at a Glance

CVE Identifier CVE-2022-1941
GHSA Identifier GHSA-8gq9-2x98-w8hf
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-1286: Improper Validation of Syntactic Correctness of Input
Affected Product Protobuf
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2022-1941

To remediate this vulnerability, upgrade all affected Protobuf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

protobuf fixed: 3.18.3
pip install protobuf>=3.18.3
protobuf fixed: 3.19.5
pip install protobuf>=3.19.5
protobuf fixed: 3.20.2
pip install protobuf>=3.20.2
protobuf fixed: 4.21.6
pip install protobuf>=4.21.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show protobuf

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-1941, inspect your installed packages using pip:

pip show protobuf

Analyze the terminal output to locate any version of Protobuf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.18.3), your application is affected.

Note: The pip show protobuf command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1286: Improper Validation of Syntactic Correctness of Input, where the product receives input that is expected to be well-formed - i.e., to comply with a certain syntax - but it does not validate or incorrectly validates that the input complies with the syntax. In Protobuf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A message parsing and memory management vulnerability in ProtocolBuffer’s C++ and Python implementations can trigger an out of memory (OOM) failure when processing a specially crafted message, which could lead to a denial of service (DoS) on services using the libraries. Reporter: [ClusterFuzz](https://google.github.io/clusterfuzz/) Affected versions: All versions of C++ Protobufs (including Python) prior to the versions listed below. ### Severity & Impact As scored by google **Medium 5.7** - [CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H) Asscored byt NIST **High 7.5** - [CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) A small (~500 KB) malicious payload can be constructed which causes the running service to allocate more than 3GB of RAM. ### Proof of Concept For reproduction details, please refer to the unit test that identifies the specific inputs that exercise this parsing weakness. ### Mitigation / Patching Please update to the latest available versions of the following packages: - protobuf-cpp (3.18.3, 3.19.5, 3.20.2, 3.21.6) - protobuf-python (3.18.3, 3.19.5, 3.20.2, 4.21.6)

CVE-2022-1941 Affected Protobuf Versions

4 component(s)
Fixed Versions:
3.18.33.19.53.20.24.21.6
Product / Package Ecosystem Affected Versions Fixed Version
protobuf
PyPI
< 3.18.3
3.18.3
protobuf
PyPI
≥ 3.19.0
< 3.19.5
3.19.5
protobuf
PyPI
≥ 3.20.0
< 3.20.2
3.20.2
protobuf
PyPI
≥ 4.0.0
< 4.21.6
4.21.6

References

Frequently Asked Questions

What is CVE-2022-1941?
CVE-2022-1941 is a security vulnerability in Protobuf involving protobuf-cpp and protobuf-python have potential Denial of Service issue under CWE-1286: Improper Validation of Syntactic Correctness of Input.
Which Protobuf versions are affected?
Affected versions include releases prior to 3.18.3, 3.19.5, 3.20.2, 4.21.6 across affected packages: protobuf.
What version fixes CVE-2022-1941?
Upgrading to 3.18.3, 3.19.5, 3.20.2, 4.21.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is protobuf affected?
Yes, protobuf is affected in releases prior to 3.18.3, 3.19.5, 3.20.2, 4.21.6. Upgrade your dependency to 3.18.3, 3.19.5, 3.20.2, 4.21.6 or later.
What is the CVSS score of CVE-2022-1941?
CVE-2022-1941 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-1941?
CVE-2022-1941 is classified under CWE-1286: Improper Validation of Syntactic Correctness of Input (The product receives input that is expected to be well-formed - i.e., to comply with a certain syntax - but it does not validate or incorrectly validates that the input complies with the syntax.).
How can I check PyPI dependencies for CVE-2022-1941?
Run the dependency tree command: 'pip show protobuf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-8gq9-2x98-w8hf",
  "modified" : "2024-07-05T21:23:56Z",
  "published" : "2022-09-23T20:31:15Z",
  "aliases" : [ "CVE-2022-1941" ],
  "summary" : "protobuf-cpp and protobuf-python have potential Denial of Service issue",
  "details" : "### Summary\n\nA message parsing and memory management vulnerability in ProtocolBuffer’s C++ and Python implementations can trigger an out of memory (OOM) failure when processing a specially crafted message, which could lead to a denial of service (DoS) on services using the libraries.\n\nReporter: [ClusterFuzz](https://google.github.io/clusterfuzz/)\n\nAffected versions: All versions of C++ Protobufs (including Python) prior to the versions listed below.\n\n### Severity & Impact\nAs scored by google  \n**Medium 5.7** - [CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)  \nAsscored byt NIST  \n**High 7.5** - [CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)\n\nA small (~500 KB) malicious payload can be constructed which causes the running service to allocate more than 3GB of RAM.\n\n### Proof of Concept\n\nFor reproduction details, please refer to the unit test that identifies the specific inputs that exercise this parsing weakness.\n\n### Mitigation / Patching\n\nPlease update to the latest available versions of the following packages:\n- protobuf-cpp (3.18.3, 3.19.5, 3.20.2, 3.21.6)\n- protobuf-python (3.18.3, 3.19.5, 3.20.2, 4.21.6)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.18.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.19.0"
      }, {
        "fixed" : "3.19.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.20.0"
      }, {
        "fixed" : "3.20.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.21.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-8gq9-2x98-w8hf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-1941"
  }, {
    "type" : "WEB",
    "url" : "https://cloud.google.com/support/bulletins#GCP-2022-019"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/protocolbuffers/protobuf"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/04/msg00019.html"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CBAUKJQL6O4TIWYBENORSY5P43TVB4M3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MPCGUT3T5L6C3IDWUPSUO22QDCGQKTOP"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/CBAUKJQL6O4TIWYBENORSY5P43TVB4M3"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MPCGUT3T5L6C3IDWUPSUO22QDCGQKTOP"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20240705-0001"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2022/09/27/1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-119", "CWE-1286" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-23T20:31:15Z",
    "nvd_published_at" : "2022-09-22T15:15:00Z"
  }
}