CVE-2026-96749 in Python Driverinfo

Summary

by MITRE • 09/24/2026

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.

If you want to get best quality of vulnerability data, you may have to visit VulDB.

Analysis

by VulDB Data Team • 09/24/2026

The vulnerability identified in this context represents a critical memory safety flaw within the BSON document encoding component of the MongoDB Python Driver’s bundled native extension. This issue arises specifically when constructing a single BSON document from caller-supplied data that exceeds typical size expectations. The core technical defect lies in the arithmetic operations used to calculate buffer sizes during the serialization process, which are performed using signed 32-bit integer types. Because the maximum value for a signed 32-bit integer is approximately two billion bytes, any input data or calculated document size approaching this limit can trigger an overflow condition where the result wraps around to become negative or significantly smaller than intended.

The severity of this flaw is compounded by the implementation details of the safety checks designed to prevent such overflows. The guard code responsible for detecting integer overflow conditions relies on behavior that is undefined according to the C language standard. In many compiler optimizations and execution environments, undefined behavior may not manifest as a runtime error or exception but rather be silently ignored or optimized away entirely by the compiler. Consequently, the protective logic intended to halt processing when an overflow is detected fails to execute reliably, allowing the application to proceed with incorrect size calculations derived from wrapped-around integer values.

When this unchecked arithmetic leads to a miscalculated buffer allocation, the subsequent memory write operations based on these flawed sizes can exceed the boundaries of the allocated heap or stack space. This results in a classic out-of-bounds write vulnerability, classified under CWE-190: Integer Overflow or Wraparound and CWE-787: Out-of-Bounds Write. An attacker who possesses no privileges but has the ability to inject large values into data streams that are subsequently encoded by the application can exploit this condition. By carefully crafting input payloads that trigger the integer overflow, an adversary can manipulate memory layout within the target process space.

The operational impact of such a vulnerability is severe and multifaceted. Depending on how the native extension was compiled and linked, as well as the specific runtime environment, an out-of-bounds write can lead to application crashes causing denial of service conditions. More critically, it opens the door for arbitrary code execution if the attacker can control both the overflowed data and the memory layout sufficiently to overwrite function pointers or return addresses. This aligns with ATT&CK technique T1203: Exploitation for Client Execution, as the vulnerability resides in a client-side driver component that processes untrusted input before interacting with the database server.

Mitigation strategies must address both immediate remediation and long-term architectural improvements. The primary mitigation involves upgrading to patched versions of the MongoDB Python Driver where this integer overflow has been corrected by utilizing larger data types such as 64-bit integers for size calculations or implementing explicit, standard-compliant checks that do not rely on undefined behavior. Additionally, developers should enforce strict input validation and size limits at the application layer before passing data to the native extension. Enabling compiler flags that detect integer overflows, such as -ftrapv in GCC/Clang, can also help identify similar issues during development phases by raising exceptions upon overflow detection rather than allowing silent wraparound behavior.

Responsible

Mongodb

Reservation

09/23/2026

Disclosure

09/24/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!