Information Security Stack Exchange is a question and answer site for information security professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I am implementing some X509 certificates in a backend service where we have our own self-signing process to allow different nodes (out of our control) to receive our blessing (as a CA of sorts).

So, my question is, as it pertains to this particular instance, (and in general, really), why would one care about hostname mismatches between the certificate and the host? A certificate is useless without the private key, so in the event of a private key compromise, isn't it "all over" so to speak, anyway? Anyone in a position to execute a man in the middle attack would be able to spoof the hostname. Is there something I'm missing?

Thanks in advance.

share|improve this question

migrated from Jul 8 '13 at 12:49

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

It is a problem in the general case.

If I make my own certificate for "" and have legitimate ownership of that domain, I could easily get it signed by a CA such as Globalsign. Your browser trusts that CA. I have both the public certificate and private key.

Now let's say I perform a man-in-the-middle against one of your customers. I present them with my own certificate, which is actually for a completely different domain name. If they don't check the host name and reject when it doesn't match, then their SSL implementation is useless.

If DNS queries are spoofed, the only thing that changes is the target IP address. The actual domain name you're attempting to communicate with is still the same, so your SSL implementation should reject the certificate still.

It is always a good idea to implement DNSSEC and certificate pinning to mitigate these kinds of issues, in the general case.

On the other hand, if the only source of trust is your own private CA, then the issue becomes lessened. If they can MitM the traffic, they still can't present you with a valid certificate. The problem becomes serious again, though, if you accept any certificate signed by a 3rd party CA, because at that point they can contact that CA, get a signed cert for any arbitrary domain, and perform MitM with it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.