Skip to main content
Vulnerability Database/CVE-2026-96747

CVE-2026-96747: MongoDB Python Driver SSRF Vulnerability

CVE-2026-96747 is an SSRF flaw in MongoDB Python Driver that allows attackers to manipulate key management endpoints and open connections to local Unix sockets. This post covers technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-96747 Overview

CVE-2026-96747 affects the MongoDB Python Driver's client-side field level encryption (CSFLE) support. The driver interprets a Key Management Service (KMS) endpoint value ending in .sock as a local Unix domain socket path instead of a remote host. An attacker with write access to encryption key metadata stored in MongoDB can redirect KMS connections to arbitrary local sockets on the application host. This issue is tracked as [CWE-918] Server-Side Request Forgery (SSRF).

The data transmitted over these connections is limited to the start of a TLS handshake, so attackers cannot send chosen content. The flaw is fixed in MongoDB Python Driver release 4.18.2.

Critical Impact

An authenticated attacker with write access to encryption key metadata can force the application process to open connections to arbitrary local Unix sockets, enabling limited internal probing from the application host.

Affected Products

  • MongoDB Python Driver (pymongo) versions prior to 4.18.2 with client-side field level encryption enabled
  • Applications using CSFLE with key metadata stored in MongoDB collections
  • Python applications relying on remote KMS endpoints configured via encryption key documents

Discovery Timeline

  • 2026-09-24 - CVE-2026-96747 published to the National Vulnerability Database
  • 2026-09-24 - Last updated in NVD database

Technical Details for CVE-2026-96747

Vulnerability Analysis

The MongoDB Python Driver supports client-side field level encryption, which uses a KMS to wrap and unwrap data encryption keys. Each data key document stores the KMS endpoint used to decrypt its material. When the driver parses an endpoint value, it treats strings ending in .sock as paths to local Unix domain sockets rather than remote hostnames.

This parsing behavior allows an attacker with write access to the key vault collection to replace or create key documents whose endpoint fields point to local sockets. When the application subsequently uses one of these keys, the driver opens a connection to the local socket on the application host. The attacker cannot inject arbitrary bytes because the driver immediately initiates a TLS handshake, limiting the data sent to standard TLS ClientHello content.

Root Cause

The root cause is improper validation of KMS endpoint values during CSFLE key resolution. The driver infers transport type from the suffix of the endpoint string, converting .sock suffixes into local socket paths without verifying that this behavior is intended for KMS communication. KMS endpoints should always resolve to remote network hosts.

Attack Vector

Exploitation requires an attacker who can write to the MongoDB collection storing CSFLE key metadata. The attacker modifies or inserts a key document with a KMS endpoint field ending in .sock. When a vulnerable Python application decrypts a field using that key, the driver connects to the specified Unix socket on the application host. The attacker can enumerate the presence of local services bound to Unix sockets, including internal management interfaces that assume socket access is trusted.

No exploitation code has been published, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. Technical details are available in the GitHub Security Advisory GHSA-qx36-8mw2-4r3x.

Detection Methods for CVE-2026-96747

Indicators of Compromise

  • Key documents in the CSFLE key vault collection containing endpoint or masterKey.endpoint field values ending in .sock
  • Unexpected connection attempts from the Python application process to local Unix domain sockets such as /var/run/*.sock or /tmp/*.sock
  • TLS ClientHello traffic observed on local socket listeners that do not expect TLS clients
  • Modifications to key vault documents by database accounts that normally do not perform key management

Detection Strategies

  • Audit MongoDB key vault collections for endpoint fields with suspicious suffixes, specifically .sock
  • Instrument the application host to log process-level connections to Unix domain sockets originating from the Python interpreter
  • Enable MongoDB audit logging on write operations against the key vault database and alert on unexpected principals
  • Compare installed pymongo versions across the fleet to identify hosts running versions prior to 4.18.2

Monitoring Recommendations

  • Forward MongoDB audit logs and application process telemetry to a centralized analytics platform for correlation
  • Monitor outbound KMS traffic patterns and alert when CSFLE key resolution deviates from the expected remote endpoints
  • Track file system access to socket paths under /var/run, /tmp, and application-specific runtime directories

How to Mitigate CVE-2026-96747

Immediate Actions Required

  • Upgrade the MongoDB Python Driver to version 4.18.2 or later across all applications using CSFLE
  • Review the key vault collection for any documents with endpoint values ending in .sock and remove or correct them
  • Restrict write access to the key vault collection to a minimal set of accounts using MongoDB role-based access control
  • Validate the integrity of all CSFLE key documents against a known-good configuration baseline

Patch Information

The fix is included in MongoDB Python Driver release 4.18.2. Upgrade using pip install --upgrade pymongo>=4.18.2. See the MongoDB Python Driver Release 4.18.2 notes and the MongoDB Python Driver Changelog for complete details.

Workarounds

  • Store CSFLE key metadata in a collection isolated from application write paths and protected by dedicated credentials
  • Enforce MongoDB field-level validation rules that reject endpoint values ending in .sock
  • Run the Python application in a restricted environment where sensitive local Unix sockets are not accessible to the application user
  • Rotate credentials used by the application if write access to the key vault cannot be immediately constrained
bash
# Upgrade the MongoDB Python Driver to the fixed release
pip install --upgrade 'pymongo>=4.18.2'

# Identify key vault documents with suspicious endpoint suffixes (example mongosh query)
mongosh --eval 'db.getSiblingDB("encryption").__keyVault.find({ "masterKey.endpoint": /\.sock$/ })'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.