X6xCyb0r_Gx9X

DNS Hacking&Hijacking

Aug 14th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. This is an introduction to DNS poisoning which also includes an example of quite a nifty application of it using the IP Experiment. It’s purely educational, so I’m not responsible for how you use the information in it.
  2. To start, you’ll need
  3. • A computer running Linux (Ubuntu in my case)
  4. • A basic understanding of how the Domain Name System (DNS) works.
  5. Note that this is a more advanced topic; don’t try this if you don’t know what you’re doing.
  6.  
  7.  
  8. Why DNS?
  9.  
  10.  
  11. The DNS provides a way for computers to translate the domain names we see to the physical IPs they represent. When you load a webpage, your browser will ask its DNS server for the IP of the host you requested, and the server will respond. Your browser will then request the webpage from the server with the IP address that the DNS server supplied.
  12. If we can find a way to tell the client the wrong IP address, and give them the IP of a malicious server instead, we can do some damage.
  13.  
  14.  
  15. Malicious DNS Server
  16.  
  17.  
  18. So if we want to send clients to a malicious web server, first we need to tell them its IP, and so we need to set up a malicious DNS server.
  19. The server I’ve selected is dnsmasq – its lightweight and the only one that works for this purpose (that I’ve found)
  20. To install dnsmasq on Ubuntu, run sudo apt-get install dnsmasq, or on other distributions of Linux, use the appropriate package manager.
  21.  
  22.  
  23. Once you’ve installed it you can go and edit the configuration file (/etc/dnsmasq.conf)
  24.  
  25.  
  26. sudo gedit /etc/dnsmasq.conf
  27.  
  28.  
  29. The values in there should be sufficient for most purposes. What we want to do is hard-code some IPs for certain servers we want to spoof
  30.  
  31.  
  32. The format for this is address=/HOST/IP
  33.  
  34.  
  35. So for example;
  36.  
  37.  
  38. address=/facebook.com/63.63.63.63
  39.  
  40.  
  41. where 63.63.63.63 is the IP of your malicious web server
  42.  
  43.  
  44. Save the file and restart dnsmasq by running
  45.  
  46.  
  47. sudo /etc/init.d/dnsmasq restart
  48.  
  49.  
  50. You now have a DNS server running which will redirect requests for facebook.com to 63.63.63.63
  51.  
  52.  
  53. Malicious Web Server
  54.  
  55.  
  56. You probably already have a web server installed. If not, install apache. This is pretty basic, so I won’t cover it here.
  57.  
  58.  
  59. There are a couple of things you can do with the web server. It will be getting all the traffic intended for the orignal website, so the most likely cause of action would be to set up some sort of phishing site
  60.  
  61.  
  62. I’ll presume you know how to do that though
  63.  
  64.  
  65. Another alternative is to set up some sort of transparent proxy which logs all activity. I might come back to this in the future.
  66.  
  67.  
  68. I Can Be Your DNS Server Plz?
  69.  
  70.  
  71. An alternative is to, instead of a spoof webserver, set up a Metasploit browser_autopwn module . You can have lots of fun with that
  72.  
  73.  
  74. But how do you get a victim? Well this is where my project, the IP Experiment could come in handy
  75.  
  76.  
  77. If you don’t know, the IP Experiment basically harvests people’s IPs through websites such as forums and scans them for open ports. A surprising number of these IPs have port 80 open and more often that not, that leads straight to a router configuration mini-site. ‘Admin’ and ‘password’ will get you far in life; its fairly easy to login and change the DNS settings.
Add Comment
Please, Sign In to add comment