Integer Overflow or Wraparound Affecting pymongo package, versions [2.0,4.18.2)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.13% (3rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-PYMONGO-20158816
  • published27 Sept 2026
  • disclosed24 Sept 2026
  • creditUnknown

Introduced: 24 Sep 2026

NewCVE-2026-96749  (opens in a new tab)
CWE-190  (opens in a new tab)

How to fix?

Upgrade pymongo to version 4.18.2 or higher.

Overview

Affected versions of this package are vulnerable to Integer Overflow or Wraparound in buffer_assure_space() in bson/buffer.c of the bundled C extension, where buffer->position + size is computed in a signed int and the guard meant to catch the wraparound is written as new_size < buffer->position, a test that depends on signed overflow and is therefore undefined behavior a compiler may discard. An attacker can write past the end of an allocated buffer inside the encoding process by placing a value large enough that a single document's encoded size crosses INT_MAX, so the wrapped negative result satisfies the space check and a short allocation is used for a longer write. This requires the application to encode attacker-influenced data approaching 2 GiB in one document, a build that uses the C extension rather than the pure Python encoder, and a compiler that eliminated the check.

CVSS Base Scores

version 4.0
version 3.1