CVE-2026-129926
MongoDB Python driver fails to strip NULs in SASL PLAIN creds, enabling field‑shifting attacks.
- CVSS 6.3
- CWE-158
- Input Validation and Sanitization
- Remote
The MongoDB Python Driver does not neutralize NUL characters in the user name and password values it places into the message it builds for SASL PLAIN authentication. A party who can choose the login values that an application passes to the driver can alter where the fields of that message begin and end. This may result in a receiving system reading a login name and secret that differ from the values the application supplied. Authenticating as a different account still requires that account's password. Only deployments that use SASL PLAIN authentication are affected.
- CWE
- CWE-158
- CVSS base score
- 6.3
- Published
- 2026-11-19
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- pymongo
- Fixed by upgrading
- Yes
Solution
Upgrade the MongoDB Python driver (pymongo) to v3.11.0 or newer, which patches the NUL‑character handling in SASL PLAIN authentication.
Vulnerable code sample
import pymongo
def get_client(username: str, password: str) -> pymongo.MongoClient:
# VULNERABLE: NUL not sanitized in credentials for SASL PLAIN
client = pymongo.MongoClient(
host="mongodb.example.com",
port=27017,
username=username,
password=password,
authSource="$external",
authMechanism="PLAIN"
)
return clientPatched code sample
import pymongo
def get_client(username: str, password: str) -> pymongo.MongoClient:
# FIX: Strip NUL characters from credentials before SASL PLAIN authentication
safe_user = username.replace("\x00", "")
safe_pass = password.replace("\x00", "")
client = pymongo.MongoClient(
host="mongodb.example.com",
port=27017,
username=safe_user,
password=safe_pass,
authSource="$external",
authMechanism="PLAIN"
)
return clientCite this entry
@misc{vaitp:cve2026129926,
title = {{MongoDB Python driver fails to strip NULs in SASL PLAIN creds, enabling field‑shifting attacks.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-129926},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-129926/}}
}
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 ::
