There are a number of ways to tamper with name res­ol­u­tion on the internet. One such attack is DNS spoofing which involves creating fake IP addresses. Here you will learn how it is done, what it is designed to do, the different methods for this kind of attack, and how you can protect yourself against it.

The basis: the Domain Name System (DNS)

The Domain Name System (DNS) is a dis­trib­uted system used worldwide for trans­lat­ing internet domain names into IP addresses. The DNS returns an IP address that is assigned to a specific domain name. This process is referred to as name res­ol­u­tion.

For name res­ol­u­tion to work, the IP address of the DNS server must be stored on each device. The device addresses its DNS request to this server which executes the name res­ol­u­tion and returns a response. If no DNS server has been stored on the device, the one for the local router will auto­mat­ic­ally be used.

Free DNS hosting in the UK
Reduce page loading speeds with free DNS
  • Faster domain res­ol­u­tion to keep you online longer
  • Added pro­tec­tion against outages and downtime
  • UK-based name servers
  • No domain transfer needed

What is DNS spoofing?

The term spoofing means “deception” or “forgery”. DNS spoofing refers to a variety of situ­ations in which DNS name res­ol­u­tion is tampered with – spe­cific­ally to the IP address of a domain name being faked. This means that the device es­tab­lishes a con­nec­tion to the fake IP address and data traffic is re­dir­ec­ted to a fake server. Here is an example:

DNS server request Returned IP address
Normal state 'example.com' '93.184.216.34'
DNS spoofing 'example.com' '192.0.2.34' (example)

Since name res­ol­u­tion largely takes place in the back­ground, the victim usually does not notice any tampering. A par­tic­u­larly insidious char­ac­ter­ist­ic of DNS spoofing is the fact that the correct domain name is displayed in the browser.

How does DNS spoofing work?

DNS spoofing is a col­lect­ive term for a variety of attack methods. The different methods are described below. The following diagram explains the basics of DNS spoofing.

  • d1. The client (e.g. the browser on the device) first requests the IP address for the host name example.com from the DNS server.
  • d2. The client receives a response to the request, but it contains a fake IP address. The con­nec­tion to the actual server for example.com is not es­tab­lished.
  • h1. Instead, the client sends the request to the malicious host behind the faked IP address.
  • h2. The malicious host returns what appears to be a le­git­im­ate website page to the client. However, the fake domain name is missing the security cer­ti­fic­ate which makes the attack visible.
  • (A, B, C): These are different attack points for DNS spoofing: on the client-side or local router, on the network con­nec­tion, and on the DNS server.

Targets of DNS spoofing

DNS spoofing is primarily used by attackers to carry out attacks – usually to steal sensitive user data. However, le­git­im­ate companies also resort to DNS spoofing from time to time. It is a known fact that some internet service providers (ISPs) have used DNS spoofing to enforce cen­sor­ship and for ad­vert­ising purposes.

What do attackers use DNS spoofing for?

Attackers use DNS spoofing for phishing and pharming attacks with the goal of in­ter­cept­ing sensitive user data. DNS spoofing makes the victim believe that they’ve ended up on a le­git­im­ate domain and uses the victim’s trust to infect them with malware and infect their own system.

What do internet service providers use DNS spoofing for?

Most people are unaware that they are using a DNS server belonging to their internet service provider. This is normally pre­con­figured in the local router. Therefore, every DNS request is under the control of the internet service provider.

For example, internet service providers can purposely rig their DNS tables to implement state cen­sor­ship re­quire­ments. In many countries, this is done to prevent users from accessing file-sharing or porn domains. If a user tries to access a blocked domain, they will be re­dir­ec­ted to a warning page instead. However, these re­stric­tions can be cir­cum­ven­ted with minimal effort by using an un­censored DNS server.

They use the same trick (i.e. re­dir­ect­ing the user to a different page when accessing certain domains) to collect user data for ad­vert­ising purposes. Internet service providers use DNS hijacking to redirect the user to a specific page when they enter non-existent or mis­spelled domains. This page may play ad­vert­ise­ments or create user profiles to then sell at a profit.

What threats does DNS spoofing pose?

The DNS is a fun­da­ment­ally useful tech­no­logy. Nearly every con­nec­tion uses it for name res­ol­u­tion. In other words, DNS spoofing can affect every single con­nec­tion es­tab­lished by the client. Whether the victim is accessing a website or sending an email: if the IP address of the server in question is spoofed, an attacker can access their data.

DNS spoofing poses the following risks in par­tic­u­lar:

  • Con­fid­en­tial data theft: Spear phishing and pharming attacks are used to steal sensitive data such as passwords. These methods are often used to hack into computer systems or for various scams.
  • System malware infection: The victim is tricked into in­stalling malware on their own system. This opens the door to further attacks and extensive espionage.
  • Col­lec­tion of com­pre­hens­ive user profiles: Personal data is collected in the process and then sold or used for ad­di­tion­al targeted spear phishing attacks.
  • May pose a per­sist­ent threat: If a malicious DNS server is set up on the system, com­mu­nic­a­tion will be com­prom­ised from this point on. Even temporary fake DNS responses may remain in the cache and can cause damage over a longer time.

Here is a concrete example. A wave of DNS spoofing attacks occurred in the spring of 2020 during the COVID-19 pandemic. This involved a router hijacking, which is when a malicious IP address is entered for the DNS server on the router. The attack was made possible due to an insecure admin access attempt on the router. The victim was suddenly displayed a warning that was allegedly from the World Health Or­gan­iz­a­tion. It said that they were about to install a COVID-19 in­form­a­tion app. In reality, the software was Trojan malware. If a trusting victim were to install the Trojan, it would search the local system and try to access sensitive data. The goal was to create a com­pre­hens­ive profile that could be used in future spear phishing attacks against the victim. The in­ter­cep­ted data included the following:

  • Cookies (browser)
  • Browsing history
  • Payment in­form­a­tion (browser)
  • Saved login in­form­a­tion (browser)
  • Saved form in­form­a­tion (browser)
  • Crypto­cur­rency wallets
  • All text files on the device
  • Databases for two-factor au­then­tic­a­tion (2fa)

Types of DNS spoofing

The following three attack types refer to the diagram above (A-C).

Type (A): attack on the client or local router

This type of DNS spoofing attack involves malicious tampering on the local device or home router. To the victim, everything seems fine at first. The device connects to the DNS server as usual. However, malicious IP addresses may be returned for the requested host names.

With this kind of attack, the threat will remain until the tampering has been corrected. Nev­er­the­less, the attacker needs an attack vector in order to tamper with anything. This can be a technical factor, such as open admin access, a weak password, or something in a similar vein. An attacker can also use social en­gin­eer­ing to trick the victim into making the change them­selves in good faith.

Changing the DNS server on the local system

The DNS spoofing attack, known as a “local hijack”, sets the IP address of the DNS server to a malicious address in the network settings of the local device.

This change can be detected by the victim and easily reversed. However, this form of tampering is often ac­com­pan­ied by malware which can restore the malicious entry if the victim changes it.

Tip

Use the online tool Who­ismyDNS to check whether you have fallen victim to this type of DNS spoofing.

Tampering with the hosts file on the local system

Most operating systems use a “hosts” file to enable name res­ol­u­tion of certain domains to be performed on the local system. If a malicious entry is placed in this file, data traffic will be re­dir­ec­ted to a server being con­trolled by the attacker.

This type of tampering is permanent. However, it can easily be detected by an ex­per­i­enced victim. To fix this problem, all you need to do is change the hosts file.

Hijacking the local router

The IP address of the internet service provider’s DNS server is set on the local router by default. In a “router hijack”, this is replaced by a malicious address. This attack poses a threat to all data traffic passing through the router. Since there are usually multiple devices in a household that will use the router to establish a con­nec­tion, several parties can fall victim to the attack.

Many users are unaware that they can configure their router them­selves. So, this attack often remains un­detec­ted for a long time. If any problems occur later, the victims are more likely to suspect that the source is their own device rather than the router. Therefore, it’s well worth con­sid­er­ing that the router might be the source of the error in the event of any weird problems.

Tip

Use the F-Secure Router Checker to check whether you have fallen victim to this type of DNS spoofing.

Type (B): attack on the DNS server’s response

This type of DNS spoofing is a man-in-the-middle attack. The attacker pretends to be the victim’s DNS server and sends them a malicious response. This type of attack works because DNS traffic uses the un­en­cryp­ted User Datagram Protocol (UDP). There is no way for the victim to verify the au­then­ti­city of the DNS response.

Other kinds of attacks such as ARP spoofing and MAC spoofing can be used to gain access to the local network. The use of en­cryp­tion tech­no­lo­gies protects against many man-in-the-middle attacks.

Type (C): attack on the DNS server

This type of DNS spoofing attack targets a le­git­im­ate DNS server and can affect a large number of users. It’s a high-level type of attack, as multiple security mech­an­isms usually have to be overcome to hack the server.

Poisoning the DNS cache on the server

DNS servers are arranged in hier­arch­ies and com­mu­nic­ate with one another. An attacker can use IP spoofing to pretend to be one of these servers and trick a server into accepting a false IP address for a domain. The server places the malicious entry in its cache, and begins “poisoning” it.

Any request to the server after the cache is poisoned will result in the malicious entry being returned to the victim. The threat will remain until the entry is removed from the cache. The DNSSEC extension serves as a server-side security mechanism. It can be used to secure server com­mu­nic­a­tion within the DNS.

Tip

Use the Domain Guard from IONOS to protect your domain from any tampering.

Hijacking a DNS server

This type of attack, also known as a “rogue hijack”, is probably the most complex kind of DNS attack. This involves an attacker taking control of a le­git­im­ate DNS server. Once com­prom­ised, even the most current DNS en­cryp­tion will provide no pro­tec­tion. However, the content en­cryp­tion should at least alert the victim to the attack.

How to protect yourself from DNS spoofing

As you can see, DNS spoofing is a serious threat. For­tu­nately, there are a number of simple measures you can take that provide effective pro­tec­tion against DNS spoofing.

Using en­cryp­tion to protect against DNS spoofing

En­cryp­tion methods generally offer two key ad­vant­ages:

  1. Data is protected from un­au­thor­ised access by third parties
  2. It ensures the au­then­ti­city of the com­mu­nic­at­ing party

The latter point is critical in the fight against DNS spoofing. If an attacker tries to pretend to be a le­git­im­ate host, this will result in a cer­ti­fic­ate error on the user side and the spoofing attempt will be detected.

Using transport en­cryp­tion

For a basic level of security, you should secure as many con­nec­tions as possible using the common transport en­cryp­tion method. Prefer­ably, websites should be accessed in the browser using HTTPS. The popular browser add-on HTTPS Every­where secures con­nec­tions to websites that transfer content over both HTTP and HTTPS. You should also make sure that the con­nec­tions con­figured in your email client (e.g. IMAP, POP3, and SMTP con­nec­tions) use secure protocols such as TLS and SSL.

If your con­nec­tions are secured by transport en­cryp­tion, you should at least be able to detect a DNS spoofing attack. Since the malicious host does not have the security cer­ti­fic­ate that the real host would have, the browser and email client will send an alert when a con­nec­tion is es­tab­lished. This gives you a chance to terminate the con­nec­tion and implement ad­di­tion­al security measures.

En­crypt­ing DNS traffic

While transport en­cryp­tion secures your data transfer, the con­nec­tion to the DNS server is still vul­ner­able and is con­sidered to be the weakest link. However, there are dedicated solutions for DNS request en­cryp­tion on the user side. The most notable of these are DNSCrypt, DNS over HTTPS (DoH), and DNS over TLS (DoT). These tech­no­lo­gies all provide pro­tec­tion against dangerous man-in-the-middle attacks. However, not one of these three solutions comes pre-in­teg­rated with any standard operating systems in a way that is suitable for the mass market. Fur­ther­more, the DNS server must also support the re­spect­ive security tech­no­logy for DNS en­cryp­tion to work.

Using a virtual private network

In addition to transport en­cryp­tion and securing the DNS server con­nec­tion, using a virtual private network (VPN) can also help to protect against DNS spoofing. When using a VPN, all con­nec­tions are routed through an encrypted tunnel. However, you should keep in mind that the IP address of a DNS server can still be stored in most VPN programs. If this is a malicious address, the VPN’s pro­tec­tion against DNS spoofing will be rendered in­ef­fect­ive.

If you don’t want to invest a lot of time in choosing a VPN provider, you can use the free Warp app from Cloud­flare. It provides VPN func­tion­al­ity and DNS en­cryp­tion over Cloud­flare’s public DNS resolver network 1.1.1.1 (see below for more in­form­a­tion).

In addition to the added security, it has an extremely user-friendly interface. The app is currently available on mobile devices and will also be available on Windows and macOS desktop computers in the future.

Using a public DNS resolver network

One of the most effective security measures you can take against DNS spoofing is using a public DNS resolver. The setup is simple enough for prac­tic­ally any user to be able to configure their own device to use. All you have to do is change the DNS server entered on your system. For example, you can use the resolver network provided by the non-profit or­gan­isa­tion Quad9, which bears the same name.

Using a public DNS resolver provides the following ad­vant­ages:

  • High-speed DNS responses: Large DNS resolver networks operate dozens of servers around the world. Thanks to Anycast routing, the phys­ic­ally closest server is always used for name res­ol­u­tion which is reflected in the short response times.
  • High level of data pro­tec­tion and anonymity: Many internet service providers sell their customers’ data that is generated by DNS traffic. These popular public resolvers generally store little to no user data, offering a high level of data pro­tec­tion and anonymity.
  • Does not enforce cen­sor­ship measures: State cen­sor­ship reg­u­la­tions are only valid within national borders. Internet service providers usually operate within their customers’ country of residence and are required to enforce state cen­sor­ship. However, a resolver network based abroad can offer its services worldwide without having to consider state-mandated cen­sor­ship.
  • Supports modern security standards: Large public DNS resolver networks spe­cial­ise in re­spond­ing to DNS requests. They are often trail­blazers in using modern security standards, such as DNSSEC, DoH, DoT, and DNSCrypt.
  • Blocks malicious domains: Using a public DNS resolver network can also help protect against malware and phishing, as these keep black­lists of known malicious domains. At­tempt­ing to access these domains will result in the user being re­dir­ec­ted to a warning page.

The following table provides an overview of popular public DNS resolver networks. In keeping with the con­ven­tion, each resolver network is con­figured re­dund­antly over two IP addresses. If the first of the two servers is not available, the second one is used. Some resolver networks offer ad­di­tion­al IP addresses which can be used to activate ad­di­tion­al functions such as for the pro­tec­tion of minors.

  Content filtering Data pro­tec­tion IP address of the name server
Quad9 Filters malicious domains Does not store user data 9.9.9.9 and 149.112.112.112
Cloud­flare DNS Family Filters malicious domains plus provides pro­tec­tion for minors Does not store user data 1.1.1.3 and 1.0.0.3
Cloud­flare DNS No filtering Does not store user data 1.1.1.1 and 1.0.0.1
DNS.watch No filtering Does not store user data 84.200.69.80 and 84.200.70.40
Summary

DNS spoofing poses a serious threat. Using a com­bin­a­tion of en­cryp­tion tech­no­lo­gies and public DNS resolver networks will provide robust security.

Go to Main Menu