Sensitive information in connection string parse errors in the Rust Driver
Description
The MongoDB Rust driver's connection-string parser can include database password text and authentication property values in the error messages it returns when a connection string is malformed. The optional error-redaction feature does not fully remove this text. A party with read access to the application's logs or error output may obtain part or all of a database credential.
Details
When parsing of a connection string fails, the resulting Error message could embed fragments of the original URI, including the password or authMechanismProperties values. For example, a password containing characters that confuse the parser can be shifted into the query segment and then reported as an unknown URI option. Applications that log or surface these errors may therefore expose credentials.
Impact
Confidentiality impact only: an attacker with read access to application logs or error output may recover part or all of a database credential.
Affected versions
mongodb crate versions >= 2.0.0 and < 3.10.2.
Patches
Fixed in mongodb 3.10.2. Sensitive connection string components are now omitted from parse-error messages until the URI has been successfully parsed.
Workarounds
Avoid logging or exposing errors returned from connection string parsing / Client::with_uri_str, or restrict access to such logs.
References
- RUST-2487
- CVE-2026-135897