Dynamic Host Configuration Protocol
Table of Contents
DHCP (Dynamic Host Configuration Protocol) is a network management protocol used to automatically assign IP addresses and other network configuration details to devices (clients) on a network. It allows devices to communicate over a network without requiring manual IP address configuration, operating on a client-server model where the server dynamically assigns addresses to devices when they connect.
Related: IP Address Subnet Mask DNS UDP Networking
Key Functions
- IP Address Assignment: DHCP automatically assigns a unique IP address to each device (client) when it joins the network, removing the need for manual IP configuration.
- Lease System: IP addresses are assigned temporarily, known as a lease, which expires after a specified time unless renewed by the client.
- Configuration Parameters: In addition to IP addresses, DHCP can
provide details such as:
- Subnet Mask
- Default Gateway
- DNS Server
- NTP Server
DHCP Process
@startuml participant Client participant Server Client -> Server: DHCP Discover (Broadcast) Server -> Client: DHCP Offer (Proposed IP) Client -> Server: DHCP Request (Accept Offer) Server -> Client: DHCP Acknowledgment (ACK) @enduml
- DHCP Discover: The client broadcasts a message to find available DHCP servers.
- DHCP Offer: The server responds with an available IP and configuration details.
- DHCP Request: The client accepts the offer and requests the server to assign the IP.
- DHCP Acknowledge (ACK): The server confirms the IP assignment to the client.
This exchange is commonly abbreviated DORA (Discover, Offer, Request, Acknowledge) — worth knowing the acronym, since it's the standard shorthand for referring to the handshake.
Protocols and Ports
- UDP for communication — server listens on port 67, client on port 68.
Security Considerations (Pentest-Relevant)
DHCP has no built-in authentication, which creates several practical attack angles worth knowing:
- DHCP Starvation: Flooding a DHCP server with bogus DISCOVER requests using spoofed MAC addresses exhausts the available IP pool, denying service to legitimate clients — a network-layer DoS.
- Rogue DHCP Server: Standing up an unauthorized DHCP server on the network to race the legitimate one — whichever OFFER a client accepts first wins, and a malicious server can hand out its own IP as the default gateway or DNS server, enabling man-in-the-middle positioning without needing ARP spoofing at all.
- DHCP Snooping (Defensive): The countermeasure — switches track which ports are allowed to source DHCP server traffic and drop OFFER/ACK packets from untrusted ports, preventing rogue servers from responding.
# Yersinia — DHCP starvation attack (interactive or CLI mode) yersinia dhcp -attack 1 # dhcpstarv — dedicated DHCP starvation tool dhcpstarv -i eth0
Tips
- On an internal/AD-focused engagement, a rogue DHCP server is a legitimate escalation path worth considering if you have network access but no clear foothold yet — redirecting DNS via a malicious DHCP OFFER can enable credential capture through forced authentication to attacker-controlled services
- DHCP Discover broadcasts are visible to every device on the same broadcast domain — passively observing DHCP traffic during recon can reveal hostnames, MAC vendor prefixes (device fingerprinting), and sometimes DHCP option 12 (hostname) or option 81 (client FQDN) without sending a single packet yourself
- If DHCP snooping is in place (common on managed switches in a hardened environment), rogue DHCP attacks will simply fail silently; confirm it's not enabled before spending time on this angle