Sub topic 13
Rogue Servers, Starvation and DHCP Snooping
This chapter assumes you know the Discover, Offer, Request, Acknowledge (DORA) exchange, how leases work, and what a switch does with broadcasts. DHCP has no built-in authentication. A client accepts the first Offer that suits it, and a server grants an address to any MAC address that asks. Attackers use both facts.
Why DHCP is easy to abuse
Discover is a broadcast, so every device on the VLAN hears it, including a device that should not be a server. The client has no way to check that an Offer came from your real server. The server cannot tell a real client from a program that fakes many client identities. Two attacks follow from these gaps.
Rogue DHCP server
A rogue server is any unauthorized device that answers DHCP requests. Often it is an accident, such as a home router plugged into an office wall port. It can also be deliberate.
A rogue server can hand out:
- A wrong address range, which breaks connectivity for the clients it serves.
- A false default gateway (option 3), which sends client traffic through the attacker's machine. This is a man-in-the-middle position.
- A false DNS server (option 6), which sends clients to fake websites.
The real server and the rogue both answer a Discover. The client usually takes whichever Offer arrives first, so the result is intermittent and hard to diagnose.
DHCP starvation
In a starvation attack, one machine sends many Discover messages. Each uses a different forged source MAC address in the client hardware field. The server gives each one a lease until the pool is empty. Real clients then get no address.
Starvation is often paired with a rogue server. The attacker empties the real pool, then answers the clients that can no longer get an address from it.
DHCP snooping
DHCP snooping is a switch feature that watches DHCP messages and filters them by port. You mark each port as trusted or untrusted.
- Trusted ports lead toward your real DHCP server or relay, such as uplinks. Server messages (Offer, Acknowledge, NAK) are allowed in.
- Untrusted ports face ordinary clients. The switch drops any server message that arrives on them, which stops rogue servers.
The switch also builds a binding table. Each entry links a MAC address, an IP address, a lease time, a VLAN and a port. Other switch features use this table. Dynamic ARP inspection and IP source guard check traffic against it, which blocks spoofed addresses.
Snooping also defends against starvation. With port security or a snooping check, the switch compares the source MAC address of the Ethernet frame with the client hardware address inside the DHCP message. A starvation tool that forges the inner MAC does not match the frame and the switch drops it. Port security can additionally limit how many MAC addresses one port may use. Many switches also rate-limit DHCP packets on untrusted ports.
Here is a typical Cisco IOS configuration:
ip dhcp snooping
ip dhcp snooping vlan 10
interface GigabitEthernet0/1
description Uplink to DHCP server
ip dhcp snooping trust
interface range GigabitEthernet0/2 - 24
ip dhcp snooping limit rate 15Ports are untrusted by default once snooping is on, so only the uplink needs the trust command.
Common mistakes
- Forgetting to trust the uplink. Offers from the real server get dropped and no client gets an address.
- Forgetting relays. If a relay agent sits behind a port, that port must be trusted. Check the switch's handling of the relay information option (option 82), because some switches drop requests that carry it on untrusted ports.
- Assuming snooping is enough. It works per switch and per VLAN. Enable it on every VLAN that has clients.
- Setting the rate limit too low. A burst of clients booting at once can trip the limit and shut the port.
Exercise
A client's traffic is passing through an unknown host, and clients report the wrong DNS server. The real DHCP server is healthy and has free addresses. Which attack is likely, and which switch setting stops it?
Show answer
A rogue DHCP server is likely. It answers Discover messages with a false gateway and DNS server. DHCP snooping stops it: mark only the ports toward the real server as trusted, so the switch drops Offer and Acknowledge messages from the untrusted client ports.
Exercise
Why does comparing the Ethernet source MAC address with the client hardware address in the DHCP message help against starvation?
Show answer
A starvation tool forges many client hardware addresses inside the DHCP messages, but the frames still carry the attacker's real source MAC. The mismatch shows the message is forged, so the switch drops it.