Figure 1: DNS query and response
DNS works in the form of queries and responses (query / response). A client that needs to resolve DNS for a certain IP address sends a query to the DNS server, which sends the requested information in its response packet. Standing on the client perspective, only the two packages that appear now are query and response.
This scenario will be a bit complicated when considering DNS regression. Thanks to the Internet DNS hierarchical structure, DNS servers need to be able to communicate with each other to provide answers to queries submitted by the client. If all goes well as expected, our internal DNS server will know the name to map the IP address to the server within the local network, but cannot expect it to know the same address. between Google or Dell. This is where recursion plays an important role. Recursion occurs when a DNS server queries another DNS server as the client creates the request. In essence, this method will turn a DNS server into a client, see Figure 3.
See page 2
DNS spoofing
There are many ways to make DNS spoofing possible. We will use a technique called DNS ID spoofing.
Each DNS query sent over the network contains a unique identifier, the purpose of this identifier is to distinguish queries and respond to them. This means that if one of our attacking computers can block certain DNS queries from being sent from a particular device, all we need to do is create a fake package. contains that identifier so that the packet is accepted by the target.
We will complete this process by taking two steps with a simple tool. First, we need to fake the ARP cache of the target device to reroute its traffic through our attacking host, which in turn can block DNS requests and send spoofed packets. The purpose of this scenario is to trick users in the target network from accessing malicious websites instead of the websites they are trying to access. For more clarity you can refer to the attack image below.
There are a number of other tools that can be used to perform DNS spoofing. We will use one of them, Ettercap, which can be used for both Windows and Linux. You can download Ettercap to your device here. If you learn a little more about this website, you will probably find that Ettercap has many other great functions besides DNS spoofing and can be used to perform many types of MITM attacks.
If you install Ettercap on a Windows computer, you will find it has a great graphical user interface (GUI), but in this example, we will use the command line interface.
Before executing Ettercap, you need to make a little configuration. Ettercap at its core level is a data sniffer, which uses plug-ins to perform various attacks.The dns_spoof plug-in is what we will do in this example, so we must adjust the configuration file associated with that plug-in. On Windows systems, this file can be downloaded at C: Program Files (x86) EttercapNGshareetter.dns , and at /usr/share/ettercap/etter.dns . This is a pretty simple file and contains the DNS records you want to fake. For testing purposes, we want any user trying to access yahoo.com to be directed to a host on the local network, add an entry highlighted in Figure 5.
These entries will instruct the dns_spoof plug-in that when you see a DNS query for yahoo.com or www.yahoo.com (with a type A resource record), it will use the IP address 172.16.16.100 to respond. pay. In the real scenario, the device at 172.16.16.100 IP address will run a web server software and display it to fake website users.
See page 3
When this file is configured and saved, it is possible to execute the command string used to launch the attack. The command string uses the following options:
The final command sequence for our purpose is:
Ettercap.exe –T –q –P dns_spoof –M arp // //
When you run the above command, you will start a two-stage attack, first spoofing the device's ARP cache on the network, then issuing fake DNS query responses.
When launched, anyone trying to access www.yahoo.com will be redirected to our malicious website.
Figure 7: Results of trying to fake DNS from the user perspective
Prevent DNS spoofing
It is quite difficult to prevent DNS spoofing because there are few signs of attack. Usually, you don't know your DNS has been tampered with until that happens. What you get is a completely different website than what you expected. In large-scale attacks, you probably won't know that you've been tricked into importing your important information into a fake website until you get a call from the bank asking why you're Withdraw so much money. Although it is difficult, not all measures can prevent these types of attacks, here are some things you need to do:
DNS spoofing is a dangerous form of MITM attack when paired with malicious intentions. Using this technology attackers can take advantage of phishing techniques to steal important user information, or install malware on a exploited drive, or cause a denial attack. service. In the next part of this article series, I will continue the discussion of how to ' pass the hash ' attacks and how this attack can be used to log on to Windows computers without to user passwords.