Cyber Services / All lessons / CEH — Ethical Hacking / ARP Poisoning Lab Guide

ARP Poisoning Lab Guide

Module 56 of 130 · 5 min read · Free to read

MODULES ↓ Command blocks have a COPY button
Understanding ARP Poisoning: ARP (Address Resolution Protocol) is used to map IP addresses to MAC addresses on a local network. ARP poisoning (or ARP spoofing) is a Man-in-the-Middle (MitM) attack where an attacker sends forged ARP messages onto a LAN. This links the attacker's MAC address with the IP address of a legitimate computer or server (often the default gateway) on the network. Once the attacker's MAC address is connected to an authentic IP address, the attacker will begin receiving any data sent to that IP address.

Prerequisites

  • Kali Linux: Installed and updated (or another Linux distribution with necessary tools).
  • Wireless Adapter: Capable of monitor mode and packet injection (e.g., Alfa AWUS036NHA).
  • Network Setup: A controlled Wi-Fi network with a target device (e.g., a computer or smartphone you own) and a router you manage.
  • Required Tools: aircrack-ng suite (airmon-ng, airodump-ng, aireplay-ng), dsniff suite (arpspoof), tcpdump or Wireshark.

Lab Setup

1. Set Up Kali Linux for Wireless Attacks

Ensure your wireless adapter is recognized and put it into monitor mode:

Identify wireless interface:
iwconfig
Note your wireless interface name (commonly wlan0).
Start monitor mode:
sudo airmon-ng start wlan0
Replace wlan0 with your adapter's interface name. This command might create a new monitor interface (e.g., wlan0mon).
Verify monitor mode:
iwconfig
Check that your adapter (e.g., wlan0mon) shows "Mode:Monitor". Use this monitor interface name in subsequent commands. Let's assume it's wlan0mon for the rest of the guide.
2. Identify Network Details

Use airodump-ng to find the target network (AP) and client devices:

Scan for networks:
sudo airodump-ng wlan0mon
Look for your target network's SSID. Note its BSSID (the router's MAC address) and the CH (channel). Press Ctrl+C to stop scanning.
Scan specific network for clients:
sudo airodump-ng --bssid [Router BSSID] --channel [Channel] wlan0mon
Replace [Router BSSID] and [Channel] with the details you noted. This will show devices connected to that specific network. Identify the MAC address (STATION) of your target device. You'll also need the IP addresses of the target device and the router (gateway) later; you might find these using network scanning tools like nmap or by checking network settings on the devices if possible.
3. Enable IP Forwarding (Crucial!)

To act as a man-in-the-middle, your Kali machine must forward traffic between the target and the router. Otherwise, the target will lose internet connectivity.

Enable IP forwarding:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
This command temporarily enables IP forwarding. It will reset on reboot.
4. Perform ARP Poisoning Using arpspoof

Open two separate terminal windows. arpspoof sends crafted ARP replies to poison the ARP caches of the target and the router.

Important: Replace [Monitor Interface] (e.g., wlan0mon or your actual interface if not using monitor mode for arpspoof - sometimes the base interface like eth0 or wlan0 is needed if you are already connected to the network), [Target IP], and [Router IP] with the actual values for your lab setup.
Terminal 1: Poison Target's Cache (Tell Target You Are Router)
sudo arpspoof -i [Monitor Interface/Network Interface] -t [Target IP] [Router IP]
This command continuously tells the target device ([Target IP]) that the MAC address associated with the router's IP ([Router IP]) is your Kali machine's MAC address.
Terminal 2: Poison Router's Cache (Tell Router You Are Target)
sudo arpspoof -i [Monitor Interface/Network Interface] -t [Router IP] [Target IP]
This command continuously tells the router ([Router IP]) that the MAC address associated with the target's IP ([Target IP]) is your Kali machine's MAC address.

Keep both terminals running.

5. Verify ARP Poisoning

On the target device (not Kali), open a command prompt or terminal and check its ARP table:

Windows:
arp -a
Linux/macOS:
arp -n
Look for the entry corresponding to the [Router IP]. The associated MAC address (Physical Address) should now be the MAC address of your Kali machine's network interface, not the router's actual MAC address. You might need to generate some traffic from the target (e.g., browse a website) for the entry to update.
6. Capture and Analyze Traffic

With ARP poisoning active and IP forwarding enabled, all traffic between the target and the router flows through your Kali machine. Open a third terminal or use Wireshark to capture this traffic.

Using tcpdump (Terminal):
sudo tcpdump -i [Monitor Interface/Network Interface] -A host [Target IP]
This captures packets on the specified interface involving the target IP and displays the content in ASCII (-A). You can see HTTP traffic, DNS requests, etc. Omit host [Target IP] to capture all traffic flowing through the interface.
Using Wireshark (GUI):
sudo wireshark
Launch Wireshark, select the correct interface ([Monitor Interface/Network Interface]), and start capturing. You can apply display filters (e.g., ip.addr == [Target IP]) to focus on traffic related to the target device. Look for interesting protocols like HTTP (for unencrypted credentials), DNS, etc.
7. Clean Up (Very Important!)

After you finish the lab, you must stop the ARP poisoning and restore the network to its normal state. Failure to do so will leave the target device unable to communicate correctly.

Stop arpspoof:

Go to the two terminals running arpspoof and press Ctrl+C in each. arpspoof should automatically send corrective ARP packets upon termination to fix the ARP tables.

Disable IP forwarding:
echo 0 | sudo tee /proc/sys/net/ipv4/ip_forward
This disables IP forwarding on your Kali machine.
Stop monitor mode (optional):
sudo airmon-ng stop wlan0mon
Returns your wireless adapter to managed mode.

Verify connectivity on the target device. It might take a moment for the ARP caches to update naturally, or you can sometimes clear the cache manually (e.g., sudo ip -s -s neigh flush all on Linux, netsh interface ip delete arpcache on Windows as admin).

Important Considerations

Ethical Use: Only perform ARP poisoning on networks and devices you explicitly own or have written permission to test. Unauthorized ARP poisoning is illegal and harmful.
Network Disruption: ARP poisoning can disrupt network connectivity if not performed correctly (especially if IP forwarding is not enabled or if cleanup fails). Always conduct these tests in a controlled lab environment.
Defense Against ARP Poisoning: Defenses include using static ARP entries (manageable only on small networks), ARP spoofing detection software (e.g., Arpwatch, XArp), and Dynamic ARP Inspection (DAI) on managed network switches.
Modules (130) ← CEH — Ethical Hacking