VAITP Dataset

← Back to the dataset

CVE-2026-129927

MongoDB Python driver may log clear‑text private key config in app output.

  • CVSS 5.7
  • CWE-532
  • Information Leakage
  • Local

A credential-handling weakness in the MongoDB Python Driver allows a configuration option value that protects private key material to be written in clear text into the embedding application's own output and log records when a driver object is converted to text. A party able to read that output may obtain the credential. Obtaining it requires read access to the application's local output or log files.

CVSS base score
5.7
Published
2026-11-19
OWASP
A09 Security Logging and Monitoring Failures
Orthogonal defect classification
Interface
Code defect classification
Incorrect Interface
Category
Information Leakage
Subcategory
Insecure Handling of Sensitive Data
Accessibility scope
Local
Impact
Information Disclosure
Affected component
PyMongo
Fixed by upgrading
Yes

Solution

Upgrade the MongoDB Python driver to pymongo 4.1.1 (or later), which removes the clear‑text logging of the private‑key configuration option.

Vulnerable code sample

import logging
from pymongo import MongoClient

def create_client(uri, keyfile, key_password):
    # VULNERABLE: password exposed when client is stringified
    client = MongoClient(uri,
                         tls=True,
                         tlsCertificateKeyFile=keyfile,
                         tlsCertificateKeyFilePassword=key_password)
    logging.basicConfig(level=logging.INFO)
    logging.info("MongoClient object: %s", client)  # password appears in log
    return client

Patched code sample

import logging
from pymongo import MongoClient

def create_client(uri, keyfile, key_password):
    # FIX: avoid stringifying client to prevent password leakage
    client = MongoClient(uri,
                         tls=True,
                         tlsCertificateKeyFile=keyfile,
                         tlsCertificateKeyFilePassword=key_password)
    logging.basicConfig(level=logging.INFO)
    logging.info("MongoClient created for URI %s", uri)  # no password in log
    return client

Cite this entry

@misc{vaitp:cve2026129927,
  title        = {{MongoDB Python driver may log clear‑text private key config in app output.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-129927},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-129927/}}
}

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.