CVE-2025-4565: Protobuf Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-8qvm-5x2c-j2w7
CWE-674
Published
Advisory Summary

CVE-2025-4565 is a HIGH denial of service vulnerability (CWE-674: Uncontrolled Recursion) affecting Protobuf libraries in the PyPI ecosystem. The issue involves protobuf-python has a potential denial of service issue. Remediation is available by upgrading affected packages to version 4.25.8, 5.29.5, 6.31.1.

CVE-2025-4565 at a Glance

CVE Identifier CVE-2025-4565
GHSA Identifier GHSA-8qvm-5x2c-j2w7
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product Protobuf
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-4565

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: 4.25.8
pip install protobuf>=4.25.8
protobuf fixed: 5.29.5
pip install protobuf>=5.29.5
protobuf fixed: 6.31.1
pip install protobuf>=6.31.1
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-2025-4565, 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 4.25.8), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. 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 Any project that uses Protobuf pure-Python backend to parse untrusted Protocol Buffers data containing an arbitrary number of **recursive groups**, **recursive messages** or **a series of [`SGROUP`](https://protobuf.dev/programming-guides/encoding/#groups) tags** can be corrupted by exceeding the Python recursion limit. Reporter: Alexis Challande, Trail of Bits Ecosystem Security Team [ecosystem@trailofbits.com](mailto:ecosystem@trailofbits.com) Affected versions: This issue only affects the [pure-Python implementation](https://github.com/protocolbuffers/protobuf/tree/main/python#implementation-backends) of protobuf-python backend. This is the implementation when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` environment variable is set or the default when protobuf is used from Bazel or pure-Python PyPi wheels. CPython PyPi wheels do not use pure-Python by default. This is a Python variant of a [previous issue affecting protobuf-java](https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-735f-pc8j-v9w8). ### Severity This is a potential Denial of Service. Parsing nested protobuf data creates unbounded recursions that can be abused by an attacker. ### Proof of Concept For reproduction details, please refer to the unit tests [decoder_test.py](https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/decoder_test.py#L87-L98) and [message_test](https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/message_test.py#L1436-L1478) ### Remediation and Mitigation A mitigation is available now. Please update to the latest available versions of the following packages: * protobuf-python(4.25.8, 5.29.5, 6.31.1)

CVE-2025-4565 Affected Protobuf Versions

3 component(s)
Fixed Versions:
4.25.85.29.56.31.1
Product / Package Ecosystem Affected Versions Fixed Version
protobuf
PyPI
< 4.25.8
4.25.8
protobuf
PyPI
≥ 5.26.0rc1
< 5.29.5
5.29.5
protobuf
PyPI
≥ 6.30.0rc1
< 6.31.1
6.31.1

References

Frequently Asked Questions

What is CVE-2025-4565?
CVE-2025-4565 is a security vulnerability in Protobuf involving protobuf-python has a potential Denial of Service issue under CWE-674: Uncontrolled Recursion.
Which Protobuf versions are affected?
Affected versions include releases prior to 4.25.8, 5.29.5, 6.31.1 across affected packages: protobuf.
What version fixes CVE-2025-4565?
Upgrading to 4.25.8, 5.29.5, 6.31.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is protobuf affected?
Yes, protobuf is affected in releases prior to 4.25.8, 5.29.5, 6.31.1. Upgrade your dependency to 4.25.8, 5.29.5, 6.31.1 or later.
What CWE is associated with CVE-2025-4565?
CVE-2025-4565 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check PyPI dependencies for CVE-2025-4565?
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-8qvm-5x2c-j2w7",
  "modified" : "2025-06-16T16:02:58Z",
  "published" : "2025-06-16T16:02:58Z",
  "aliases" : [ "CVE-2025-4565" ],
  "summary" : "protobuf-python has a potential Denial of Service issue",
  "details" : "### Summary\nAny project that uses Protobuf pure-Python backend to parse untrusted Protocol Buffers data containing an arbitrary number of **recursive groups**, **recursive messages** or **a series of [`SGROUP`](https://protobuf.dev/programming-guides/encoding/#groups) tags** can be corrupted by exceeding the Python recursion limit.\n\nReporter: Alexis Challande, Trail of Bits Ecosystem Security Team\n[ecosystem@trailofbits.com](mailto:ecosystem@trailofbits.com)\n\nAffected versions: This issue only affects the [pure-Python implementation](https://github.com/protocolbuffers/protobuf/tree/main/python#implementation-backends) of protobuf-python backend. This is the implementation when `PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python` environment variable is set or the default when protobuf is used from Bazel or pure-Python PyPi wheels. CPython PyPi wheels do not use pure-Python by default.\n\nThis is a Python variant of a [previous issue affecting protobuf-java](https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-735f-pc8j-v9w8).\n\n### Severity\nThis is a potential Denial of Service. Parsing nested protobuf data creates unbounded recursions that can be abused by an attacker.\n\n### Proof of Concept\nFor reproduction details, please refer to the unit tests [decoder_test.py](https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/decoder_test.py#L87-L98) and [message_test](https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/message_test.py#L1436-L1478)\n\n### Remediation and Mitigation\nA mitigation is available now. Please update to the latest available versions of the following packages:\n* protobuf-python(4.25.8, 5.29.5, 6.31.1)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.25.8"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.26.0rc1"
      }, {
        "fixed" : "5.29.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "protobuf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.30.0rc1"
      }, {
        "fixed" : "6.31.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-735f-pc8j-v9w8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/security/advisories/GHSA-8qvm-5x2c-j2w7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-4565"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/commit/17838beda2943d08b8a9d4df5b68f5f04f26d901"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/protocolbuffers/protobuf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/decoder_test.py#L87-L98"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/blob/main/python/google/protobuf/internal/message_test.py#L1436-L1478"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/protocolbuffers/protobuf/tree/main/python#implementation-backends"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-06-16T16:02:58Z",
    "nvd_published_at" : "2025-06-16T15:15:24Z"
  }
}