I've been playing around with DNS rebinding. I made a little setup and I have it working fine with regular HTTP requests. I then tried to get it working over HTTPS and had a little "duh" moment:

baddomain.com uses an invalid security certificate.

The certificate is only valid for *.target.com


Browsers will check the cert for every request. With DNS rebinding, you are making subsequent request to the same "domain" but a different IP. The cert of the "rebinded" target doesn't match the originating domain, so we get a cert issue.

Is it safe to assume HTTPS services are not vulnerable to DNS rebinding attacks?

2 Answers 2


TL;TR: HTTPS will help against DNS rebinding.

Each new TLS session established by the browser validates the subject of the certificate against the domain of the URL. With DNS rebinding the victim initially visits a attacker controlled domain and after an attacker controlled DNS change the IP address for this domain changes to point to same (maybe internal) host.

After this DNS change the domain in the URL is still the attackers domain which means that the browser expects the certificate for the new TLS connection to match this domain. But, the new target host has only a certificate for its own domain and not for the attackers domain. This means that the TLS handshake will fail, either because the server refuses the handshake since the SNI name in the ClientHello does not match the servers configuration or because the browser will reject the certificate from the server since it does not match the name in the URL.


In short, yes HTTPS protects against this kind of attack because the server (Bob) and the client (Alice) are communicating using a symmetric encryption key agreed upon during the key exchange. Therefore Mallory doesn't know what the symmetric key is and can't pretend to be Bob (man in the middle attack) or decrypt any of the traffic.

  • While the conclusion is right the explanation is wrong: "pretending to be Bob", i.e. authentication, is done with the certificate (asymmetric) and not with the symmetric key from a previous session. Also, DNS rebinding does not involve man in the middle at all, i.e. no traffic decryption. Commented Sep 26, 2016 at 13:00
  • You can pretend to be Bob with the certificate or symmetric key. The certificate is only used to setup the symmetric encryption. Since authorisation of Bob using the cert is only done during the key exchange I can't see how I'm incorrect. DNS rebinding could be used to attempt a man in the middle, but it wouldn't work so no decryption would occur. What's your point?
    – Robo
    Commented Sep 26, 2016 at 20:43
  • Oh right I think I misundertood how a dns rebinding attack would work
    – Robo
    Commented Sep 26, 2016 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .