Hi, Ours is an LDAP client application that fetches LDAP server names on the fly using DNS SRV Resource Records. We then randomly pick one the servers returned from DNS, establish an SSL/TLS connection with that server and then perform a bind operation using user credentials (DN and password). User credentials are protected since everything goes encrypted between the client and server.
Recently we discovered that such a mechanism could be vulnerable to a DNS spoofing attack where an attacker could modify (or drop) the server list returned by the DNS and inject his/her own malicious directory server name. Client would then blindly establish an SSL/TLS connection with that server and would end up handing over the user credentials to it. Note that, as part of the SSL handshake, the malicious serve would provide a certificate signed by the same CA that signed a genuine server certificate. Meaning to say, verification of the malicious server certificate would pass at the client. If you still want to know how, I can explain further. Also note that the malicious server is hosted on a machine with host name similar to the value of SubjectName's "cn" attribute of the certificate it offers. In such a case, how can I stop this attack? Is it against SSL/TLS philosophy to fetch server names on the fly as we do above using DNS as it defeats the very essence of matching hostnames with the "cn" attribute? Or is there way at the SSL/TLS level for the client to identify that it's talking to a bad server? Or, as a last option should I put some check in the client application itself that would identify the bad server? PS: DNSSEC is not an option for me. Thanks, Sandeep