Vulnerabilities in pkg:pypi/cbor2

PACKAGE
Advisory Identifier: GHSA-9q9c-vjxh-p795
Advisory Summary

CVE-2025-64076 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-191: Integer Underflow (Wrap or Wraparound)) affecting Cbor2 libraries in the PyPI ecosystem. The issue involves cbor2 c extension decoder flaws can cause denial of service. Remediation is available by upgrading affected packages to version 5.7.1.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/cbor2

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/cbor2. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9q9c-vjxh-p795 CVE-2025-64076 HIGH cbor2 C extension decoder flaws can cause denial of service
GHSA-wcj4-jw5j-44wh CVE-2025-68131 MODERATE CBORDecoder reuse can leak shareable values across decode calls
GHSA-3c37-wwvx-h642 CVE-2026-26209 HIGH cbor2 has a Denial of Service via Uncontrolled Recursion in cbor2.loads
GHSA-375g-39jq-vq7m CVE-2024-26134 HIGH Potential buffer overflow in CBOR2 decoder

CVE-2025-64076 at a Glance

CVE Identifier CVE-2025-64076
GHSA Identifier GHSA-9q9c-vjxh-p795
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-191: Integer Underflow (Wrap or Wraparound)
Affected Product Cbor2
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-2025-64076

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

cbor2 fixed: 5.7.1
pip install cbor2>=5.7.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 cbor2

How to Check if You Are Affected

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

pip show cbor2

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-191: Integer Underflow (Wrap or Wraparound), where the product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result. In Cbor2, 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

Multiple vulnerabilities exist in cbor2 through version 5.7.0 in the decode_definite_long_string() function of the C extension decoder (source/decoder.c): 1. Integer Underflow Leading to Out-of-Bounds Read (CWE-191, CWE-125): An incorrect variable reference and missing state reset in the chunk processing loop causes buffer_length to not be reset to zero after UTF-8 character consumption. This results in subsequent chunk_length calculations producing negative values (e.g., chunk_length = 65536 - buffer_length), which are passed as signed integers to the read() method, potentially triggering unlimited read operations and resource exhaustion. 2. Memory Leak via Missing Reference Count Release (CWE-401): The main processing loop fails to release Python object references (Py_DECREF) for chunk objects allocated in each iteration. For CBOR strings longer than 65536 bytes, this causes cumulative memory leaks proportional to the payload size, enabling memory exhaustion attacks through repeated processing of large CBOR payloads. Both vulnerabilities can be exploited remotely without authentication by sending specially-crafted CBOR data containing definite-length text strings with multi-byte UTF-8 characters positioned at 65536-byte chunk boundaries. Successful exploitation results in denial of service through process crashes (CBORDecodeEOF exceptions) or memory exhaustion. The vulnerabilities affect all applications using cbor2's C extension to process untrusted CBOR data, including web APIs, IoT data collectors, and message queue processors. Fixed in commit 851473490281f82d82560b2368284ef33cf6e8f9 pushed with released version 5.7.1.

CVE-2025-64076 Affected Cbor2 Versions

1 component(s)
Fixed Versions:
5.7.1
Product / Package Ecosystem Affected Versions Fixed Version
cbor2
PyPI
< 5.7.1
5.7.1

References

Frequently Asked Questions

What is CVE-2025-64076?
CVE-2025-64076 is a security vulnerability in Cbor2 involving cbor2 C extension decoder flaws can cause denial of service under CWE-191: Integer Underflow (Wrap or Wraparound).
Which Cbor2 versions are affected?
Affected versions include releases prior to 5.7.1 across affected packages: cbor2.
What version fixes CVE-2025-64076?
Upgrading to 5.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is cbor2 affected?
Yes, cbor2 is affected in releases prior to 5.7.1. Upgrade your dependency to 5.7.1 or later.
What is the CVSS score of CVE-2025-64076?
CVE-2025-64076 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-2025-64076?
CVE-2025-64076 is classified under CWE-191: Integer Underflow (Wrap or Wraparound) (The product subtracts one value from another, such that the result is less than the minimum allowable integer value, which produces a value that is not equal to the correct result.).
How can I check PyPI dependencies for CVE-2025-64076?
Run the dependency tree command: 'pip show cbor2'. 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-9q9c-vjxh-p795",
  "modified" : "2026-09-01T16:37:10Z",
  "published" : "2025-11-18T18:32:55Z",
  "aliases" : [ "CVE-2025-64076" ],
  "summary" : "cbor2 C extension decoder flaws can cause denial of service",
  "details" : "Multiple vulnerabilities exist in cbor2 through version 5.7.0 in the decode_definite_long_string() function of the C extension decoder (source/decoder.c): \n\n1. Integer Underflow Leading to Out-of-Bounds Read (CWE-191, CWE-125): An incorrect variable reference and missing state reset in the chunk processing loop causes buffer_length to not be reset to zero after UTF-8 character consumption. This results in subsequent chunk_length calculations producing negative values (e.g., chunk_length = 65536 - buffer_length), which are passed as signed integers to the read() method, potentially triggering unlimited read operations and resource exhaustion. \n2. Memory Leak via Missing Reference Count Release (CWE-401): The main processing loop fails to release Python object references (Py_DECREF) for chunk objects allocated in each iteration. For CBOR strings longer than 65536 bytes, this causes cumulative memory leaks proportional to the payload size, enabling memory exhaustion attacks through repeated processing of large CBOR payloads. \n\nBoth vulnerabilities can be exploited remotely without authentication by sending specially-crafted CBOR data containing definite-length text strings with multi-byte UTF-8 characters positioned at 65536-byte chunk boundaries. Successful exploitation results in denial of service through process crashes (CBORDecodeEOF exceptions) or memory exhaustion. The vulnerabilities affect all applications using cbor2's C extension to process untrusted CBOR data, including web APIs, IoT data collectors, and message queue processors. Fixed in commit 851473490281f82d82560b2368284ef33cf6e8f9 pushed with released version 5.7.1.",
  "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" : "cbor2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-64076"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/agronholm/cbor2/issues/264"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/agronholm/cbor2/pull/265"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/agronholm/cbor2/commit/851473490281f82d82560b2368284ef33cf6e8f9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/agronholm/cbor2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/agronholm/cbor2/releases/tag/5.7.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/cbor2/PYSEC-2025-238.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-191" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-01T16:37:10Z",
    "nvd_published_at" : "2025-11-18T18:16:14Z"
  }
}