Skip to content

← Public intelligence

PyPI package

pymongo

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

7 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. High, CVSS 8.2PyPIAmendedPublished

    MongoDB Python Driver: Out-of-bounds read in BSON decoding via a malformed Regex element

    CVE-2026-106435 · GHSA-98qm-wvgf-w4cf

    Affected
    • PyPI pymongo >= 3.9.0, < 4.18.3
    Fixed in
    4.18.3· Vendor fix available
    Issue
    Impact The C extension's BSON decoder scans a Regex element's pattern and flags strings with strlen before checking the document's remaining length, so a crafted truncated Regex element can read past the end of the caller's buffer. bson.decode and bson.decode_all accept mmap and array buffers, which carry no NUL sentinel; the read can cross into unmapped memory and kill the process with an uncatchable SIGSEGV. Any application decoding untrusted BSON from such buffers is affected — impact is availability only, since the out-of-bounds bytes are never returned as content. NUL-terminated buffers (bytes, bytearray) raise `InvalidBSON` at worst; the driver's own transport and pure-Python installs are not affected. All releases through 4.18.2 are affected when the C extension is loaded. Patches Fixed in PyMongo 4.18.3. Malformed Regex elements now raise InvalidBSON on every accepted buffer type; valid documents decode unchanged. Workarounds Decode untrusted BSON only from…

    Recommended action: Upgrade to 4.18.3 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  2. High, CVSS 7.5PyPIAmendedPublished

    PyMongo: PYTHON-5996 Heap out-of-bounds write via signed size overflow in BSON document encoding

    CVE-2026-96749 · GHSA-v4x9-3549-crwv

    Affected
    • PyPI pymongo < 4.18.2
    Fixed in
    4.18.2· Vendor fix available
    Issue
    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.

    Recommended action: Upgrade to 4.18.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  3. High, CVSS 8.3PyPIAmendedPublished

    PyMongo: PYTHON-5986 Host injection in PyMongo connection string parsing via percent-encoded delimiters

    CVE-2026-96748 · GHSA-vp6j-j7w5-5xjj

    Affected
    • PyPI pymongo >= 3.5.0, <= 4.18.1
    Fixed in
    4.18.2· Vendor fix available
    Issue
    PyMongo percent-decoded the entire host section of a connection string before splitting it into individual host:port entries. A percent-encoded , or : in a hostname therefore decoded into a real delimiter, injecting an additional attacker-chosen host and port into the client's seed list. Impact An application that interpolates untrusted input into a MongoDB connection string -- for example, a tenant name or hostname fragment taken from a request -- could be made to add an attacker-controlled server to the seed list. Because %2C and %3A survive most URL-safety checks and only become delimiters inside PyMongo's parser, input that looks like a single hostname to the application becomes two hosts to the driver. The client may then perform topology discovery and authentication against the attacker's host, exposing credentials, or route operations to it. Unix domain socket paths, the only host identifiers that legitimately require percent-encoding, are not affected. Patches Fixed…

    Recommended action: Upgrade to 4.18.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  4. Medium, CVSS 5.3PyPIAmendedPublished

    PyMongo: PYTHON-5990 Forced Unix domain socket connection via a .sock KMS endpoint in client-side field level encryption

    CVE-2026-96747 · GHSA-qx36-8mw2-4r3x

    Affected
    • PyPI pymongo >= 3.9.0, <= 4.18.1
    Fixed in
    4.18.2· Vendor fix available
    Issue
    PyMongo passed the KMS endpoint of a data key verbatim into parsehost(), which returns any string ending in .sock unchanged instead of validating it as a hostname and port. The driver's connection code then treats such an address as a Unix domain socket path and connects to it with AFUNIX. Because the endpoint originates from masterKey.endpoint in a key vault document, a party who can write to the key vault could redirect the driver's KMS connection to an arbitrary Unix domain socket path on the application host. Impact An application using client-side field level encryption (CSFLE) or Queryable Encryption is affected if an attacker can write to its key vault collection. Setting masterKey.endpoint on a data key to a .sock-suffixed string causes the next KMS request for that key (key cache TTL is ~60 seconds) to open an AFUNIX connection to the attacker-chosen filesystem path from inside the victim application process. The documented custom KMS endpoint feature supports TCP…

    Recommended action: Upgrade to 4.18.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  5. Medium, CVSS 6.1PyPIAmendedPublished

    pymongo: PYTHON-5994 Use exact match for file ID in GridFS delete methods

    CVE-2026-88029 · GHSA-8fvv-fgr5-f8ch

    Affected
    • PyPI pymongo <= 4.18.0
    Fixed in
    4.18.1· Vendor fix available
    Issue
    Impact When reading/writing via an ID with the GridFS API, require an exact match on the given ID. Otherwise, if a Hash is given in place of the ID, it may be interpreted as criteria, overriding the ID match. Patches Patch available in pymongo = 4.18.1 Workarounds Ensure your existing workflow only supports exact matching on the GridFS API.

    Recommended action: Upgrade to 4.18.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  6. Medium, CVSS 4.7PyPIAmendedPublished

    PyMongo Out-of-bounds Read in the bson module

    CVE-2024-5629 · GHSA-m87m-mmvp-v9qm

    Affected
    • PyPI pymongo < 4.6.3
    Fixed in
    4.6.3· Vendor fix available
    Issue
    Versions of the package pymongo before 4.6.3 are vulnerable to Out-of-bounds Read in the bson module. Using the crafted payload the attacker could force the parser to deserialize unmanaged memory. The parser tries to interpret bytes next to buffer and throws an exception with string. If the following bytes are not printable UTF-8 the parser throws an exception with a single byte.

    Recommended action: Upgrade to 4.6.3 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  7. Medium, CVSS 6.9PyPIAmendedPublished

    Use of NullPointerException Catch to Detect NULL Pointer Dereference in Pymongo

    CVE-2013-2132 · GHSA-x33v-f3gp-gw2c

    Affected
    • PyPI pymongo < 2.5.2
    Fixed in
    2.5.2· Vendor fix available
    Issue
    bson/cbsonmodule.c in the mongo-python-driver (aka. pymongo) before 2.5.2, as used in MongoDB, allows context-dependent attackers to cause a denial of service (NULL pointer dereference and crash) via vectors related to decoding of an "invalid DBRef."

    Recommended action: Upgrade to 2.5.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →