SRV parent-domain check bypass via unvalidated host names returned in SRV records
Description
With mongodb+srv:// connection strings, the MongoDB .NET/C# Driver normalizes the seed host name and the host names returned by SRV lookups, but did not require that the normalized name be a single valid host name. A crafted SRV target could therefore pass the SRV parent-domain check while the driver connected to a different host outside the application's domain. TLS does not prevent this, because the server certificate is validated against the host the driver actually connects to, which would belong to the attacker.
Impact
Applications that use mongodb+srv:// connection strings (the default for Atlas clusters). Exploitation requires the attacker to control the SRV DNS answer for the cluster's domain. If successful, the application connects to and authenticates with a server controlled by the attacker, potentially exposing credentials and data and allowing attacker-controlled responses. No error is surfaced to the user.
Patches
Fixed in MongoDB.Driver 3.14.1. Host names used with mongodb+srv:// are now validated after normalization, for both the seed host and the hosts returned by SRV lookups (including periodic re-resolution). Valid DNS names are unaffected.
Workarounds
Use a standard mongodb:// seed list instead of mongodb+srv://, and ensure the DNS resolvers used by the application are trusted.