DNS is important in resolving the URLs you enter into the address bar of your browser. A lot of work goes into Domain Name Resolution. It is a sort of recursive operation that helps your browser get the IP address of the website you are trying to reach out. If interested, you can read more about DNS Lookup and Servers.
The term DNS Cache refers to the local cache that contains the resolved IP addresses of websites that you frequent. The idea of DNS Cache is to save time that would otherwise be spent on contacting DNS servers that would start a set of recursive operations to find out the actual IP address of the URL you need to reach. But this cache can be poisoned by cyber criminals simply by changing the entries in your DNS cache to fake IP addresses for the websites you use.
What is DNS Hijacking
As the name suggests, DNS Hijacking or Redirection is a method used by cybercriminals to hijack your browser’s attempt to resolve the IP address of the website you wish to load. For ease of use, the URLs we use are in text format. For each URL, there is an IP address, and a set of operations go into converting the text URL into a numerical IP address. Since there are many operations involved in resolving the IP address, cybercriminals can take advantage of the delay and send to your computer, a fake IP address that belongs to them.
The most common method for DNS Hijacking is to install a malware on your computer that changes the DNS so that whenever your browser tries to resolve a URL, it contacts one of the fake DNS servers instead of real DNS servers that are used by ICANN (authority of Internet that is responsible for registering domains, managing them, providing them with IP addresses, maintaining the contact addresses and more). The direct DNS servers that your computer contacts are the DNS servers being operated by your Internet Service Provider – unless you’ve changed them to something else. When an internet connection is bought, the DNS servers in use are of the ISP – recognized by ICANN.
The malware on your computer changes the default DNS trusted by your computer to point to some other IP address. That way, when your browser tries to resolve an IP address, your computer contacts a fake DNS server that gives you wrong IP address. This results in your browser loading a malicious website that may compromise your computer or steal your credentials etc.
DNS Hijacking vs. DNS Cache Poisoning
Though both happen at the local level, their origins are from fake DNS servers. While the DNS hijacking involves a malware, the DNS Cache poisoning involves overwriting your local DNS cache with fake values that redirect your browser to malicious websites. DNS Cache Poisoning or Spoofing involves techniques such as the bombardment of fake IP addresses that your computer picks up while the genuine DNS servers are still busy resolving the URL. That is, in the time that takes by genuine DNS servers to resolve a URL, the cybercriminals send plenty of responses that equate the URL with fake IP addresses.
For example, you type thewindowsclub.com in your browser. By the time a genuine DNS server looks up the addresses, your computer receives more than one resolutions that the site is at XYZ IP address. This will make your computer believe that the site is at XYZ even though the genuine DNS server sends the genuine IP address because the cybercriminals’ DNS servers sent many responses containing a fake IP for thewindowsclub.com.
This difference in time is used effectively by cyber criminals who have many fake DNS servers to get your computer note down wrong and malicious IP addresses to the cache. So one out of the ten fake DNS resolutions sent by cybercriminals’ DNS servers takes precedence over one genuine DNS resolution sent by the genuine DNS servers. Other methods of DNS Cache Poisoning and prevention are listed in the link provided above.
Though DNS Cache Poisoning and DNS Hijacking are used interchangeably, there is a small difference between them. The method of DNS Cache Poisoning does not involve injecting malware into your computer system but is based on different methods like the one explained above where fake DNS servers send a URL resolution faster than the genuine DNS server and thus the cache is poisoned. Once the cache is poisoned, when you use an infected website, your computer is compromised. In the case of DNS Hijacking, you are already infected. A malware changes your default DNS service provider to something that the cybercriminals want. And from there, they control your URL resolutions (DNS lookups), and then they keep on poisoning your DNS cache.
How to prevent DNS Hijacking
We have discussed how to prevent DNS poisoning already. To stop or prevent DNS Hijacking, it is recommended that you use a good security software that keeps malware such as DNS changers away. Using a good Firewall. While a hardware-based firewall is best, if you do not have it, you could turn on your router firewall at the least.
If you think you are already infected, it is better to delete the contents of HOSTS file and reset the Hosts File. After doing this, go ahead and use an antimalware that helps you get rid of DNS Changers.
Check if any DNS changer has changed your DNS. If it has, you should change your DNS settings. You can check it automatically. Alternatively, you can check for the DNS manually. Start by checking the DNS mentioned in Router and then in individual computers on your network. I would recommend that you flush your Windows DNS Cache and change your router DNS to some other DNS like Comodo DNS, Open DNS, Google Public DNS, Yandex Secure DNS, Angel DNS, etc. A secure DNS in the router is better than configuring each computer.
Now read: What is Domain Hijacking and how to recover a hijacked domain.