![]() |
|
[Tutorial] ~ Man in the Middle Attack via DHCP Exhaustion on Windows Server 2012 R2 - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Whitehat • Blue Team • Defensive Security (https://hackforums.net/forumdisplay.php?fid=448) +---- Forum: Pentesting and Forensics (https://hackforums.net/forumdisplay.php?fid=231) +---- Thread: [Tutorial] ~ Man in the Middle Attack via DHCP Exhaustion on Windows Server 2012 R2 (/showthread.php?tid=4774154) |
[Tutorial] ~ Man in the Middle Attack via DHCP Exhaustion on Windows Server 2012 R2 - Goodies - Apr 11, 2015 When it comes to network attacks, we are constantly looking for the most recent and up-to-date attack vectors in modern network environments. With this tutorial, I'd like to go over the steps needed to become MITM of new network devices in networks with the most up-to-date software (Windows Server 2012 R2 and Windows 8.1). The goal of this is to inform you of how DHCP attacks work as well as protections against them to ensure the most secure environment for your users. This attack does not utilize ARP spoofing, so even if there are anti-ARP-spoofing security measures, such as an IPS or Dynamic ARP Inspection, it should still be able to run. This simple tutorial should give you a better understanding of how your network works. Explanation: The Dynamic Host Configuration Protocol (DHCP) was created to allow machines to connect to networks without statically assigning IP addresses and receiving information such as a default gateway, DNS servers, and an IP address. The four-way handshake is as follows:
Tutorial: In ye olde times, it may have sufficed to quickly write your own DHCP packets with minimal configuration in SCAPY to run this attack, but as Servers become more resistant to such simple-minded methods, I choose to rely on already-established applications capable of execution this. The program that I will use is called DHCPig and can be downloaded at this GitHub link. 1. Preparation: We need to install the DHCP server that we will be using as well as download the DHCPig application and enable IPv4 packet forwarding. I have moved the pig file to the /usr/bin directory so I can execute it from anywhere with the pig command. Code echo "1" > /proc/sys/net/ipv4/ip_forward2. Rogue DHCP Server: Once the prerequisites have been installed, we can set up the DHCP server that we will deploy on the network. First, we need to know some information about the network.
Important configuration settings:
3. Execution: Before we start the attack, we can see the DHCP server leases which only contains the Kali machine: Spoiler (Click to View) Once the Pig application is installed, we simply have to execute pig eth0 where "eth0" is your networking interface. Code pig eth0As you watch the exhaustion take place on your machine, we can see the leases in the Windows Server 2012 R2 machine filling up with pseudo-random MAC addresses. Attacker Machine: (Click to View) Windows Server: (Click to View) ![]() When you see the following success message, you know that you are ready to deploy the UDHCPD server. You can do this by starting the udhcpd service: Code /etc/init.d/udhcpd start4. Impact: Since the legitimate DHCP server is no longer capable of handling requests, the rogue DHCP server will be accepting all requests. When a new device joins the network, under these settings, they will use the attacker as the default gateway. Now, since this is not a layer 2 attack, we need to understand that this will only capture traffic that is destined to exit the network. You may still perform a Man in the Middle attack, as well as ARP poisoning to get L2 MITM, but if you are only interested in capturing Internet traffic, then this is perfectly sufficient. The impact that this can have on a network is enormous. After all, you control their gateway. From a Windows 8.1 machine, I connected to the same network and got an IP address. This is the result: Spoiler (Click to View) Note that the default gateway is that of the attacker machine. This means that all network traffic that is not destined for a local network machine will be sent to you for further processing. Protection: There are several ways to protect against this attack, however, from my experience as a network engineer, very few network administrators actually implement this as they are often more focused on connectivity and simplicity than on security. Essentially all security engineers absolutely should implement these protections:
I hope you all learned something and enjoyed this simple tutorial! * - Hooded Robin - Apr 11, 2015 This a great write up man, always love reading your stuff 👍 I used dhcppig in a similar manner to eat up all available address and force clients to an evil dhcp server to pull off the linux dhcp shellshock attack (root exploit) when it was all the rage not too long ago 🤭 * - Goodies - Apr 11, 2015 (Apr 11, 2015 08:12 PM)Hooded Robin Wrote: This a great write up man, always love reading your stuff 👍 That's awesome! PinkPanther and I actually wrote a DHCP server config for exactly that! Also, I know this is simple, but I'm hoping that it will lead to slightly more complex tuts. * - Ichi - Apr 12, 2015 Very neat tutorial, Goodies! I always enjoy your stuff, I usually learn something new about networking. The possibilities are endless with this :) Simple, yet effective. Not sure why this thread hasn't received more love * - ElViruZ - Apr 12, 2015 Nice Guide. Learned something new. Thx for this Tut!!! * - DrDinosaur - Apr 12, 2015 TL;DR. JK. Good job :) Now I have a lot better understanding of this attack. * - xtremegamer1882 - Apr 13, 2015 Great tutorial. Easy to understand. Thanks for sharing. 👍 * - sp3ctrum - Apr 13, 2015 Very nice and detailed Tutorial goodies! Learned something new today that I will be deploying on my companies network (: * - Goodies - Apr 16, 2015 Just under 200 views and 7 replies. Haha. @-Gator- I'd recommend NOT doing this in your company's network unless you have explicit permission to do so bcause this WILL cause connection issues; not to mention most companies, mine included, have a "do not hack me" rule in which doing such an attack on employees, even with the most innocent intentions, is still grounds for firing. I should mention how easy this attack is to detect, by the way. The answer is "very." 1. Look at the MAC addresses of the exhausted IP addresses. With this program, they are in a clear pattern (you can change it in the source, though... keep in mind that no just any random MAC address will work with most modern-day switches. They need to be in certain ranges.) 2. Look at the switches' CAM tables to see which MAC addresses are attached to which port. Or, better yet, just look at which untagged interfaces have multiple MAC addresses... It's not meant to be a covert attack, but if you do this on a pseudo-public network, there's not much they can do after-the-fact. * - sp3ctrum - Apr 16, 2015 (Apr 16, 2015 11:00 PM)Goodies Wrote: Just under 200 views and 7 replies. Haha. Yea this needs more attention, guessing even with pictures, etc.. most users just don't understand or run away lol Thanks for the extra tips as well Goodies, and I wasn't going to run this on my companies main network, defiantly wouldn't end well for me xD Was just saying patch it because I'm a server administrator and most of our machines are Windows 08-12 and I'm quite sure this can be pulled off on our network. Just going to setup a test lab to present and deploy the given security measures. * - Goodies - Apr 16, 2015 There's really no patch for this because it isn't a Windows error. In fact, blocking DHCP requests could block legitimate requests. People can't seem to figure out that we, as security admins, know what you're doing. You're not in the shadows. When there's an attack on my network, 90% of the time it's very easy to find not only the machine, but its physical location within minutes of the attack actually being executed. * - powerl105 - Apr 17, 2015 good stuff. going to test it out...... * - amg64 - Apr 18, 2015 Such an awesome thread with full of information, I was following most of your thread and what I can simply say that you making a very neat tutorial regardless of the readers is newbie or advanced. Thumbs up! Keep sharing your information bro. * - Lord_pYrOs - Apr 19, 2015 Very well written Goodies, this section needs more posts like this. * - Goodies - Apr 20, 2015 Hey, I appreciate it you guys. I'm always learning new security implementations at work. This attack is old, but effective nonetheless. I hope to have a tutorial on NTLM relaying and some SMB attacks for you all soon. Windows 2012 R2 and 8.1 are vulnerable to RDP login via NTLM hashes. Should be interesting since they're the newest (available) OSes. |