Skip to content

Update dependency pymongo to v4.18.2 [SECURITY] - autoclosed - #340

Closed
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-pymongo-vulnerability
Closed

renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-pymongo-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
pymongo 4.18.0 → 4.18.2 age confidence

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

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

More information

Details

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.

Severity

  • CVSS Score: 6.1 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:H/VA:H/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


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

More information

Details

Summary

PyMongo passed the KMS endpoint of a data key verbatim into parse_host(), 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 AF_UNIX. 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 AF_UNIX connection to the attacker-chosen filesystem path from inside the victim application process. The documented custom KMS endpoint feature supports TCP hosts only, so this crosses a boundary the feature was never intended to allow.

Impact is limited to the side effects of the connection itself. The socket is still wrapped in a verifying TLS context using the .sock string as server_hostname, and insecure KMS TLS options are rejected, so the handshake always fails and the KMS message is never sent. The attacker controls the connect target but not the transmitted bytes (a fixed TLS ClientHello).

Applications that do not use CSFLE or Queryable Encryption are not affected. Applications whose key vault is not writable by untrusted parties are not affected.

Patches

Fixed in PyMongo 4.18.2 _EncryptionIO.kms_request now rejects a .sock-suffixed KMS endpoint with pymongo.errors.ConfigurationError immediately after parsing, before any connection is attempted, on both the synchronous and asynchronous paths. No application code changes are required beyond upgrading.

Workarounds

If you cannot upgrade immediately:

  • Restrict write access to the key vault collection to trusted principals only. This is the recommended configuration regardless of this issue.
  • Validate masterKey.endpoint on data keys you create, and audit existing key vault documents for endpoints ending in .sock.
Details
  • _EncryptionIO.fetch_keys reads key vault documents from the server and hands them to libmongocrypt, which surfaces the stored masterKey.endpoint verbatim as kms_context.endpoint.
  • _EncryptionIO.kms_request passed that string to parse_host(endpoint, 443). parse_host returns entities ending in .sock verbatim, skipping the hostname and port validation applied to every other input.
  • _create_connection (and the async equivalent) checks host.endswith(".sock") and performs an AF_UNIX sock.connect(host), treating the string as a filesystem path.

Severity

  • CVSS Score: 5.3 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:L/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


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

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

More information

Details

Summary

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 in PyMongo 4.18.2. Percent-decoding was moved into split_hosts and now applies only to Unix domain socket paths, identified by an unescaped .sock suffix before decoding, and only after splitting on ,.

Workarounds

Do not interpolate untrusted input into the host portion of a connection string. If unavoidable, reject or percent-decode-and-validate the value before building the URI.

Details

The decoding was introduced in PyMongo 3.5.0 (PYTHON-1282), where unquote_plus was applied to the whole host section in _validate_uri and, later, _parse_srv, before the string was split on , and :.

Severity

  • CVSS Score: 8.3 / 10 (High)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


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

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

More information

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

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: 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

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

mongodb/mongo-python-driver (pymongo)

v4.18.2: PyMongo 4.18.2

Compare Source

Community notes: https://www.mongodb.com/community/forums/t/pymongo-4-18-2-released/343732

CVE-2026-96749
CVE-2026-96748
CVE-2026-96747

v4.18.1: PyMongo 4.18.1

Compare Source

Community notes: https://www.mongodb.com/community/forums/t/pymongo-4-18-1-released/343338


Configuration

📅 Schedule: (in timezone Etc/UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Oct 8, 2026
@renovate
renovate Bot requested review from dragomirp and welpaolo October 8, 2026 22:24
@github-actions github-actions Bot added the Libraries: Out of sync The charm libs used are out-of-sync label Oct 8, 2026
@renovate renovate Bot changed the title Update dependency pymongo to v4.18.2 [SECURITY] Update dependency pymongo to v4.18.2 [SECURITY] - autoclosed Oct 9, 2026
@renovate renovate Bot closed this Oct 9, 2026
@renovate
renovate Bot deleted the renovate/pypi-pymongo-vulnerability branch October 9, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync The charm libs used are out-of-sync not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants