POC Setup for Kaminsky’s DNS Finding
Posted in /home/open-source, /home/research, /research/hacking_penetration on October 12th, 2008 by Rick ZhongLast Thursday I gave a presentation on Dan Kaminsky’s recent DNS finding to the local security meetup group folks. It has been a while since the previous time I laid my hands on network packets analysis, tweaking a bind9 server and even backtrack 3 looks fresh and interesting to me again.
Initially I thought it would be a huge task to set up a full POC environment of the DNS attack. I was planning and thinking about all the details such as the race conditions, full-function attacker controlled DNS server, segregation of testing environment. However the more I plann, the messier it becomes and until a point which I told myself - forget about it, this is not a huge corporate project which you need all the planning, risk analysis etc etc . Let’s just be a normal script kiddy - get an available exploits, understand it and set up a minimum environment to try it, if it works, that’s it. If it doesn’t work, then we analyze what the problem is. This turned out to be a fanatasic plan and again all my old friends - VMware, Ubuntun, Metasploit, Wireshark and Backtrack came into rescue. Here is the simple but fully workable setup (all in one Lenonvo T61 laptop) :
Vulnerable DNS server
- Ubuntu 8.04 LTS Desktop Edition in VMware (server 1.06)
- IP address: 192.168.1.13
- with Bind9 packages installed
- A little tweaking of the named options (fixed query source port and allow recursion to the attacker’s subnet, see attached named option files)
Attacker machine
- Backtrack 3 Final in VMware (This is availabe directly from the home page, you don’t need to install into harddisk anymore)
- IP address: 192.168.1.24
- Update your Metasploit to make sure the auxiliary/spoof/DNS/bailiwicked_host” is available
Client PC
- Windows XP (The host machine which has the vmware-server installed)
- IP address: 192.168.1.4
- It just serves as a poor third-party DNS client who queries the vulnerable DNS server for IP info
The successful rate for the POC is quite high, more than 70% of the spoof attacks (using the Metaslpoit module) were able to successfully inject the records to the vulnerable DNS server within 20 minutes. I have attached a copy of Metasploit screen output and a corresponding wireshark traffic dump for one of the POC attacks - make the vulnerable DNS server point www.jpmorgan.com point to ip address 192.168.1.226.
The POC for this attack is pretty safe because the traffic is only routed within the LAN except the initial target DNS nameservers list queries. Anyway the initial queries are harmless at all because they are just normal DNS query to a third party DNS server. Lastly the Metasploit’s check for recusive DNS server is a bit buggy. It throws out false-negative and always consider the target vulnerable DNS “not vulnerable”. I am yet to find out the reason.
Bind9 Named Config Options: namedconf.options
Metasploit Console Output: msf_output_jpmorgan
Meetup Slides: understand-kaminskys-dns-attacks-oct-2008.ppt