Exploiting DHCP vulnerabilities is likely to be within the skills of the novice troublemaker on your LAN. A scope exhaustion attack is surprisingly simple to execute and potentially difficult to detect and isolate. Fortunately, preventing one is fairly straightforward if you have switches in your network with the right features. This post primarily covers symptoms and detection, a later post will discuss prevention.
Let me preface the rest of this post by saying that I’m conducting these experiments in an isolated lab environment.
Do not test exploits on a production network.
Lab Setup
My test environment consists of three virtual machines, Ubuntu (the attacker), a Windows 2003 server running DHCP (the target) and an Xp VM running Wireshark (the observer).
I’ve set up two vSwitches, each with it’s own uplink port (vmnic2 & vmnic3). Both uplinks are connected to a Cisco Catalyst 3560. VSwitch2 has two port groups, the Lab Target-Promiscuous port group is set to promiscuous mode to allow packets on vSwitch2 to be captured by Wireshark running on the Xp VM.

Running the Exploit
I’m using Yersinia on the Ubuntu VM to launch the DHCP attack against the Windows 2003 server.
Yersinia is capable of generating DHCPDISCOVER requests at a rapid rate and can quickly exhaust a DHCP scope.

Wireshark provides a better look into just how many DHCPDISCOVER messages are being generated Yersinia, each from a different spoofed MAC addresses.
The DHCP server returns a DHCPOFFER until all of the available addresses in the scope are exhausted.

Forensics
Windows DHCP allocates an address from the appropriate pool when a DHCPDISCOVER message is received.
In the DHCP console, note how none of the addresses are displayed in the Address Leases pane. A check of the scope statistics reveals that something is a miss. Take special note of these stats:
Discovers – 69523
Offers – 100 (offers will be made until the available addresses in the scope are exhausted)
In Use – 100% (the DHCP scope is exhausted)

Clicking Refresh will update the stats. If the attack is still occurring, the Discovers counter will increment significantly with each refresh.
When the scope is exhausted, two entries will be made in the System Event Log, Event ID 1063 and 1020, both stating that the scope is full and no addresses are available.
Restarting the DHCP server service releases the addresses and returns them to the pool. Otherwise, DHCP will return the addresses to the pool after ten minutes. If the attack is no longer running, everything will appear normal.
Detection
One possible detection method would be to use Perf Mon to monitor DHCP Discovers/sec. An alert could be automatically generated if the counter was over a certain threshold. Yersinia generated over 6000 DHCP Discovers/sec on a 100Mbps link in this test. On most networks, a high rate of DHCPDISCOVER requests would be considered abnormal. Below is the Perfmon trace from the DHCP server while the attack was running.

Since Yersinia is capable of spoofing the MAC of each DHCPDISCOVER request, locating the attacker on your network can be a challenge. If you have managed switches the process is a little easier. If not, then the threat of this type of attack is a good justification to consider adding managed switches with decent security features to your infrastructure.
Viewing the MAC Address table on the 3560 reveals that the switch has essentially been turned into a hub. It took Yersinia about ten seconds to fill the MAC table with bogus entries.

We’ll need to look at the interface statistics to isolate the port that the attacker is using. Granted, only two ports on the switch are active, but even on a busier network Fa0/7 would be suspect based on RXBS. Note these stats are based on a 5 minute average.

If only it were that easy. Any good hacker would be unlikely to keep the exploit running for long. Considering that it took Yersinia about three seconds to deplete a scope of 100 IP addresses, it’s unlikely that amount of traffic would stand out from the background noise on the LAN. We need a way to monitor a sudden increase in MAC address entries on a port. I’ll cover that along with port security and DHCP-Snooping in a later post.
If you find this topic interesting, consider picking up the book LAN Switch Security: What Hackers Know About Your Switches. (Cisco Press – ISBN 1587052563)