DNS domain lock-up attack and DNS rebinding attack
DNS domain lock-up attack and DNS rebinding attack
Picture this: you’re browsing a shady website, which happens to have a malicious script running:
<script src=”http://clear-your-bank-account.com/ad.js“>.
For protection, the script will typically only be able to access the domain you are currently browsing
and not some other domain (such as your-bank.com) because of the same-origin policy. This is one of
the most essential safety measures of the internet, and all browsers enforce this. It ensures that a
malicious script running on one website will not be able to send requests to another website, and thus
won’t be able to, for example, clear your bank account.
This, however, is very much exploitable using DNS rebinding.
When performing a DNS rebinding attack, the hacker registers a web domain, i.e., malware.com, and
assigns it to its own DNS server, giving the lookup response a very short time to live (TTL) to prevent
DNS caching and forcing your browser to perform repeated lookups. The attacker then gets his victim
to load malware.com on their browser (this can be done via phishing or a number of other means).
When the victim loads the website, it triggers the malicious script on site.
This is where it gets interesting: the script starts making weird requests, which will depend on the
attacker’s goal. It’s not a problem if the requests only get as far as malware.com. However, since the
set TTL time is very low, another DNS lookup is performed, only now the response is a different IP
address – the victim’s home router, for example.
The reason this works is the DNS links different IP addresses to the same domain name, thus
bypassing the browser’s same origin policy.