CVE-2026-96749: PyMongo PYTHON-5996 Heap Out-of-bounds Write Vulnerability

HIGH
Advisory Identifier: GHSA-v4x9-3549-crwv
CVSS 8.4
CWE-190
Published
Advisory Summary

CVE-2026-96749 is a HIGH (CVSS 8.4) python-5996 heap out-of-bounds write vulnerability (CWE-190: Integer Overflow or Wraparound) affecting PyMongo libraries in the PyPI ecosystem. The issue involves python-5996 heap out-of-bounds write via signed size overflow in bson document encoding. Remediation is available by upgrading affected packages to version 4.18.2.

CVE-2026-96749 at a Glance

CVE Identifier CVE-2026-96749
GHSA Identifier GHSA-v4x9-3549-crwv
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-190: Integer Overflow or Wraparound
Affected Product PyMongo
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2026-96749

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

pymongo fixed: 4.18.2
pip install pymongo>=4.18.2
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 pymongo

How to Check if You Are Affected

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

pip show pymongo

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-190: Integer Overflow or Wraparound, where the product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. this occurs when an integer value is incremented to a value that is too large to store in the associated representation. when this occurs, the value may become a very small or negative number. In PyMongo, 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

An integer overflow in the BSON document encoding component of the MongoDB Python Driver's bundled native extension may occur when a single document is built from an unusually large amount of caller-supplied data. Size arithmetic is performed in a signed 32-bit type, and the guard meant to catch the overflow is written in a form whose behavior is not defined by the C language standard. A party with no privileges who can place a very large value into data that an application encodes may, depending on how the native extension was built, cause a write outside the bounds of an allocated buffer inside the application's own process.

CVE-2026-96749 Affected PyMongo Versions

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

References

Frequently Asked Questions

What is CVE-2026-96749?
CVE-2026-96749 is a security vulnerability in PyMongo involving PYTHON-5996 Heap out-of-bounds write via signed size overflow in BSON document encoding under CWE-190: Integer Overflow or Wraparound.
Which PyMongo versions are affected?
Affected versions include releases prior to 4.18.2 across affected packages: pymongo.
What version fixes CVE-2026-96749?
Upgrading to 4.18.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pymongo affected?
Yes, pymongo is affected in releases prior to 4.18.2. Upgrade your dependency to 4.18.2 or later.
What is the CVSS score of CVE-2026-96749?
CVE-2026-96749 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-96749?
CVE-2026-96749 is classified under CWE-190: Integer Overflow or Wraparound (The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.).
How can I check PyPI dependencies for CVE-2026-96749?
Run the dependency tree command: 'pip show pymongo'. 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-v4x9-3549-crwv",
  "modified" : "2026-10-05T23:47:11Z",
  "published" : "2026-10-05T23:47:10Z",
  "aliases" : [ "CVE-2026-96749" ],
  "summary" : "PyMongo: PYTHON-5996 Heap out-of-bounds write via signed size overflow in BSON document encoding",
  "details" : "An integer overflow in the BSON document encoding component of the MongoDB Python Driver's bundled native extension may occur when a single document is built from an unusually large amount of caller-supplied data. Size arithmetic is performed in a signed 32-bit type, and the guard meant to catch the overflow is written in a form whose behavior is not defined by the C language standard. A party with no privileges who can place a very large value into data that an application encodes may, depending on how the native extension was built, cause a write outside the bounds of an allocated buffer inside the application's own process.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pymongo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.18.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/security/advisories/GHSA-v4x9-3549-crwv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-96749"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/pull/3066"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/commit/640dd2383a1a2fb1a10e5222d50ebc0b22a61bd7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/commit/6ab44be0e97c9d1d5a23725c4978fb25f3249485"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb/mongo-python-driver"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/blob/4.18.2/doc/changelog.rst"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/releases/tag/4.18.2"
  }, {
    "type" : "WEB",
    "url" : "https://www.mongodb.com/community/forums/t/pymongo-4-18-2-released/343732"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-190" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T23:47:10Z",
    "nvd_published_at" : "2026-09-24T19:17:20Z"
  }
}