CVE Watchtower

CVE-2026-96747pymongo Improper Input Validation

NVD

Vulnerability Summary

### 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 Level
MEDIUM(5.0)
Published Date
Sep 24, 2026
Last Modified
Oct 5, 2026
Exploitation Status
No confirmed exploitation yet
CVE Record Status
Published
EPSS Score (30-Day)
0.19%Probability
Root Weakness (CWE)
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required.
The web server receives a URL or similar request from an upstream component and retrieves its contents, but does not sufficiently ensure that the request is being sent to the expected destination.
CVSS v4.0 Base Metrics — Score 5.3
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
Attack VectorNetwork
Attack ComplexityLow
Attack RequirementsNone
Privileges RequiredLow
User InteractionNone
Confidentiality (Vulnerable System)None
Integrity (Vulnerable System)None
Availability (Vulnerable System)None
Confidentiality (Subsequent System)Low
Integrity (Subsequent System)None
Availability (Subsequent System)None
Show CVSS v3.x metrics (score 5.0)
CVSS v3.1 Base Metrics — Score 5.0
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredLow
User InteractionNone
ScopeChanged
ConfidentialityLow
IntegrityNone
AvailabilityNone

Affected & Patched Versions

Affected Versions
  • pymongo >= 3.9.0, <= 4.18.1
Patched Versions
No patched version published yet
Until a fix ships, reduce exposure:
  • Restrict access to the affected service or interface to trusted networks.
  • Disable the affected feature if you do not need it.
  • Watch the vendor advisory for a firmware or software update.

What to do

Fix it during your normal patch cycle. No exploitation is confirmed yet.

  1. Check whether you run pymongo and which version.
  2. No patched version is listed yet. Limit access to the affected service to trusted networks, and disable the feature if you can.
  3. Subscribe to the vendor advisory so you learn when a fix ships.

Timeline

  • Sep 24, 2026Published
  • Oct 5, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new pymongo CVEsYou are reading CVE-2026-96747. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Oct 6, 2026 01:57 UTC