DNS servers are essential to the normal functioning of the internet as we know and love it, but they tend to go unnoticed by most users. At least, that is, until some sort of attack or incident occurs that stops them from working normally, which results in the services we use every day starting to fail (something that happened recently when the Mirai botnet attacked a company called DynDNS).
One thing for sure is that there is more than one type of attack that can affect these servers—and in this article we will look at the differences between them.
What is a DNS server?
The Domain Name System (DNS for short) is what enables us to resolve the name of a web page through its IP address. This way, as users, we do not need to remember the sequence of numbers that makes up an IP address (or numbers and letters in IPV6) and we can access, for example, a web page like “www.facebook.com” by writing it like that in our browser, rather than entering “220.127.116.11”.
Resolving this user-friendly name into an IP address is the work of DNS servers, which they do by referring to a hierarchical distributed database that stores information about which IP address corresponds to which domain name, among other things. This system makes it easier to remember website addresses, and also means the IP address can be changed if needed.
Knowing how important these servers are, it is not surprising that many attacks attempt to exploit vulnerabilities either in them or in the way users use them.
DNS Spoofing vs. DNS Cache Poisoning
Often interpreted as the same type of attack, in reality these two techniques are technically different from one another. Generally speaking, we could say that DNS Cache Poisoning is one of the many ways to achieve DNS Spoofing, which refers to the wide range of existing attacks aimed at supplanting the information stored on DNS servers.
DNS Spoofing would represent the ultimate goal of the attack (to manage to change the registries stored on the DNS server in whatever way the attackers decide), for which different mechanisms are used. They include DNS Cache Poisoning, but also man-in-the-middle attacks, the use of fake base stations, and even compromising the security of the DNS server.
We can also see examples of DNS spoofing in attacks aimed at users. One of these would be supplanting the address of the DNS servers configured on our operating system or router. The usual way is to enter the address of the DNS servers of our internet service provider, or those of another organization such as Google, as we can see below:
DNS Cache Poisoning refers to the situation in which many end users use the same cache, where the registries that are stored correlate each IP address with a domain. In the event attackers manage to manipulate a DNS entry in this registry, the internet service providers that use this cache would accept it as authentic, even if it has been manipulated to point to a fake website.
In such a case, what we would have is a poisoned DNS cache that does not redirect traffic to the legitimate IP address when resolving a domain name. Obviously, poisoning this type of cache is not as easy as with the existing cache in a system or router, but technically it is possible and there are precedents.
One of the main problems of DNS Cache Poisoning attacks is that they can be propagated among different DNS servers, and therefore over time they can affect domestic routers too, including the existing DNS cache in the user’s system, as the router would receive this incorrect information and update its local cache with it.
To carry out this type of attack, the attackers need a web server and a DNS server, configuring their own authoritative DNS and a trap domain. From that point, the attackers need first to get the victim to access with their own DNS the link with the trap domain, in order to then start gathering the identifiers of the transaction until they are in a position where they can predict what the next one will be.
Having reached this point, the victim’s DNS will be obliged to make a request to the attackers’ authoritative DNS, which may be pointing to a domain supplanting a banking website. Now that the attackers have discovered what the new transaction ID will be, they can send packets to try and supplant the legitimate connections the user receives when trying to connect to his or her bank.
Because the attackers can predict the correct transaction ID, the victim’s DNS will store the supplanted entry in its cache and accept it as valid. From this point on, any attempt by the victim to access a bank’s website will result in being redirected to the website controlled by the attackers.
What about DNS hijacking?
Malware can also be used to affect the resolution of domain names so the victims connect to a server controlled by the criminals. There are examples of malware like Win32/DNSChanger , which modify the DNS established by the user or our internet service provider. We can see how they work in the following image:
This enables the attackers to carry out a wide variety of attacks, ranging from phishing – in other words using fake websites which the victim visits thinking they are real (having accessed them by entering the correct address in their browser) – to the use of exploits to take advantage of vulnerabilities while the user is browsing what are believed to be trusted web pages but which have in fact been generated by the attackers in order to infect the user.
The clearest example, however, is that of networks of zombie computers, otherwise known as botnets. A lot of these modify the DNS servers that their victims have configured, making them point to others controlled by the attackers. This way, as well as the malicious actions we have already described, the criminals can send commands to the bots, update the version of the malware, or even remove it from the system if necessary.
As we have seen, there are numerous types of attacks that can stop a domain from being resolved correctly and cause users to fall unwittingly into traps laid by criminals, thinking they are accessing a legitimate site. To avoid these types of threats, investing in a good security solution is recommended, and, if possible, one that includes a tool for monitoring the security of your router.
And speaking of routers, it’s never a bad idea to check whether your router’s security is adequate. It’s always advisable to ensure it is properly updated and configured, so that no one can access it unauthorized, and we should avoid using weak passwords or having services activated which allow remote connections to the router.