# GHSA-XXPM-9Q2V-748W: Authentication identity smuggling via NUL characters in username and password options in the PHP Driver

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2026-12-03
- Modified: 2026-12-03

## Tracked as

- [CVE-2026-143881](https://cve.now/CVE-2026-143881.md): MongoDB PHP Driver authentication identity confusion in SASL PLAIN

## Affected versions

- mongodb/mongodb-extension (Packagist): from 1.0.0, fixed in 1.21.16
- mongodb/mongodb-extension (Packagist): from 2.0.0, fixed in 2.1.16
- mongodb/mongodb-extension (Packagist): from 2.2.0, fixed in 2.5.10

## Description

### Impact

The MongoDB PHP Driver extension passes the `username` and `password` URI options to libmongoc as C strings. A value containing a NUL character is silently truncated at that character instead of being rejected. When SASL PLAIN authentication is used (for example, with LDAP), the username and password are sent in a single NUL-delimited message. An application that builds credentials from untrusted input can therefore have extra fields injected into the authentication message, which may let a user authenticate as a different identity.

Exploitation requires the application to pass attacker-influenced values as the `username` or `password` options, and the attacker needs valid credentials for the identity being targeted. Credentials supplied in the connection string are not affected, because libmongoc already rejects a percent-encoded NUL (`%00`).

### Patches

Fixed in MongoDB PHP Driver 1.21.16, 2.1.16, and 2.5.10. The driver now throws `MongoDB\Driver\Exception\InvalidArgumentException` when the `username` or `password` option contains a NUL character. Users should upgrade to a patched release.

### Workarounds

Validate that credentials do not contain NUL characters before passing them to the `MongoDB\Driver\Manager` constructor or the `username` and `password` URI options. Avoid PLAIN authentication with untrusted credential input.

### References

- https://github.com/mongodb/mongo-php-driver/releases/tag/1.21.16
- https://github.com/mongodb/mongo-php-driver/releases/tag/2.1.16
- https://github.com/mongodb/mongo-php-driver/releases/tag/2.5.10
- https://jira.mongodb.org/browse/PHPC-2818
- https://github.com/mongodb/specifications (Authentication specification: DRIVERS-3599)

## References

- https://github.com/mongodb/mongo-php-driver/security/advisories/GHSA-xxpm-9q2v-748w

Page: https://cve.now/GHSA-XXPM-9Q2V-748W

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
