VAITP Dataset

← Back to the dataset

CVE-2026-96747

MongoDB Python driver treats .sock endpoint as local socket, letting key metadata open local connections.

  • CVSS 5.3
  • CWE-918
  • Configuration Issues
  • Local

The client-side field level encryption support in the MongoDB Python Driver can treat a key management endpoint value ending in ".sock" as a local Unix domain socket path rather than a remote host. A user with write access to the encryption key metadata stored in the database can cause an application using the driver to open connections to local sockets on the application host. Data sent over these connections is limited to the start of a TLS handshake, so no chosen content is transmitted.

CVSS base score
5.3
Published
2026-09-24
OWASP
A10 Server-Side Request Forgery (SSRF)
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Configuration Issues
Subcategory
Server-Side Request Forgery (SSRF)
Accessibility scope
Local
Impact
Unauthorized Access
Affected component
pymongo
Fixed by upgrading
Yes

Solution

Upgrade the MongoDB Python Driver (pymongo) to version 4.7.0 or later, which patches the client‑side field level encryption socket handling vulnerability.

Vulnerable code sample

from pymongo import MongoClient
from pymongo.encryption import Algorithm, ClientEncryption

def get_encrypted_client(kms_endpoint: str) -> MongoClient:
    # VULNERABLE: endpoint ending ".sock" treated as Unix domain socket
    kms_providers = {
        "aws": {
            "accessKeyId": "AKIA...",
            "secretAccessKey": "SECRET...",
            "endpoint": kms_endpoint  # e.g., "kms.local.sock"
        }
    }

    key_vault_namespace = "encryption.__keyVault"
    client = MongoClient("mongodb://localhost:27017")
    client_encryption = ClientEncryption(
        kms_providers,
        key_vault_namespace,
        client,
        {"mongocryptdBypassSpawn": True}
    )
    return client_encryption._mongocryptd_client  # placeholder for encrypted client

Patched code sample

from pymongo import MongoClient
from pymongo.encryption import Algorithm, ClientEncryption

def get_encrypted_client(kms_endpoint: str) -> MongoClient:
    # FIX: reject or normalize ".sock" endpoints to avoid Unix socket interpretation
    if kms_endpoint.endswith(".sock"):
        raise ValueError("KMS endpoint must not end with '.sock'")
    kms_providers = {
        "aws": {
            "accessKeyId": "AKIA...",
            "secretAccessKey": "SECRET...",
            "endpoint": kms_endpoint
        }
    }

    key_vault_namespace = "encryption.__keyVault"
    client = MongoClient("mongodb://localhost:27017")
    client_encryption = ClientEncryption(
        kms_providers,
        key_vault_namespace,
        client,
        {"mongocryptdBypassSpawn": True}
    )
    return client_encryption._mongocryptd_client

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Merge commit from fork (mongodb/mongo-python-driver)
    pymongo/asynchronous/encryption.py · _EncryptionIO.kms_request, pymongo/synchronous/encryption.py · _EncryptionIO.kms_request
  • Prep 4.18.2 release (#3066) (mongodb/mongo-python-driver)
    pymongo/asynchronous/uri_parser.py, pymongo/asynchronous/uri_parser.py · _parse_srv, pymongo/synchronous/uri_parser.py, pymongo/synchronous/uri_parser.py · _parse_srv, pymongo/uri_parser_shared.py · split_hosts, pymongo/uri_parser_shared.py · _validate_uri, pymongo/_version.py

Cite this entry

@misc{vaitp:cve202696747,
  title        = {{MongoDB Python driver treats .sock endpoint as local socket, letting key metadata open local connections.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-96747},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-96747/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.