Important
This release addresses several CVEs and contains breaking changes. Please find more details below.
-
CSHARP-6221 / CVE-2026-129937: Authentication identity smuggling via NUL-byte injection in SASL PLAIN payload
Creating or parsing aPLAINcredential whoseusernameorpasswordcontains aNUL(\0) character now throwsArgumentException. -
CSHARP-6205 / CVE-2026-129936: Credential exposure via sensitive connection string values included in parse-error messages
ToString()onMongoUrl,MongoUrlBuilderandConnectionStringnow returns a redacted URL. Usernames, passwords and other sensitive values become <redacted>.MongoServerAddress.ToString()andMongoCredential.ToString()now return fixed type names, so they no longer expose host, port or username.MongoClientSettings.ToString()no longer includes server addresses or credential details.- Exception messages from connection-string parsing, SRV validation, address parsing and authentication no longer include user-supplied values.
Action required. Any code that uses these ToString() results as a connection string, key or identifier will break:
MongoUrl: replaceurl.ToString()withurl.Url.MongoUrlBuilder: replacebuilder.ToString()withbuilder.ToMongoUrl().Url. Passingbuilder.ToMongoUrl()straight to newMongoClient(...)also works.ConnectionString: there is no public way to get the unredacted string back. Keep the original string you passed in.MongoServerAddress: use$"{address.Host}:{address.Port}"instead ofToString().MongoCredential: readcredential.Usernameandcredential.Sourceinstead ofToString().
-
CSHARP-6283 / CVE-2026-129938: SRV host normalization logic should be explicit
Hostnames used withmongodb+srv://are now validated after normalization. This covers the seed host and the hosts returned by SRV lookups, including periodic re-resolution. This is normally a non-issue, since valid DNS names are unaffected. -
CSHARP-6216: Wrong regex produced for String.IndexOfAny with an empty or null char array
The full list of issues resolved in this release is available at CSHARP JIRA project.
Documentation on the .NET driver can be found here.