Cyber Services / All lessons / CEH — Ethical Hacking / Wireless ARP Poisoning Attack

Wireless ARP Poisoning Attack

Module 93 of 130 · 8 min read · Free to read

MODULES ↓ Command blocks have a COPY button
Understanding ARP Poisoning: The Address Resolution Protocol (ARP) is used to map IP addresses to MAC addresses on a local network. ARP poisoning (also known as ARP spoofing) is a Man-in-the-Middle (MitM) attack technique where an attacker sends falsified ARP messages onto a local area network. This allows the attacker to associate their MAC address with the IP address of a legitimate host (like the default gateway). As a result, any traffic destined for that IP address is sent to the attacker instead, allowing them to intercept, inspect, or modify the traffic before forwarding it (or not) to the actual destination.
Lab Objective: To understand and execute an ARP poisoning attack on a wireless network in a controlled environment. Students will learn to redirect traffic from a victim machine to their attacker machine, effectively becoming a "man-in-the-middle."
Ethical Hacking Disclaimer & Safety Warning:

This lab is for educational purposes ONLY and must be conducted in a completely isolated and controlled lab environment that you own or have explicit written permission to test on. DO NOT attempt this on any network you do not own. Unauthorized network interference or traffic interception is illegal and carries severe penalties. You are responsible for your actions.

Ensure both the attacker and victim machines are connected to your isolated lab Wi-Fi network.

Lab Prerequisites

Hardware:
  • Attacker Machine: A computer (physical or VM) running Kali Linux (or another penetration testing distribution).
  • Victim Machine: Another computer (physical or VM, e.g., Windows, Linux, or macOS) connected to the same wireless network as the attacker.
  • Legitimate Access Point: A Wi-Fi router or mobile hotspot that you control, providing the wireless network for the lab.
Software (on Attacker Machine):
  • arpspoof (part of the dsniff suite) or Ettercap. This lab will focus on arpspoof for clarity.
  • Wireshark (for traffic sniffing)
  • Text editor (e.g., nano, vim)
Network Setup:
  • Both the attacker and victim machines must be connected to the same wireless LAN segment (same SSID, same subnet).
  • Identify the IP address of the victim machine and the default gateway (router).

Lab Phases & Steps

Phase 1: Reconnaissance & Information Gathering

1. Identify Network Interfaces and IP Addresses (Attacker Machine):

ip addr show

Note your attacker machine's wireless interface name (e.g., wlan0) and its IP address.

ip route show

Note the IP address of your default gateway (router).

2. Identify Victim's IP Address:

This can be done in several ways in a real scenario (e.g., network scanning with Nmap, DHCP logs). For this controlled lab:

  • On the Victim Machine, find its IP address:
    • Windows: ipconfig in Command Prompt.
    • Linux/macOS: ip addr show or ifconfig in Terminal.
Let's assume:
  • Attacker IP: 192.168.1.100
  • Victim IP: 192.168.1.150
  • Gateway IP: 192.168.1.1
  • Attacker Wireless Interface: wlan0

3. Check ARP Cache (Optional - Before Attack):

On both the victim and attacker machines, you can view the current ARP cache to see the legitimate MAC addresses associated with IPs.

arp -n

Observe the MAC address associated with the gateway IP and the victim IP (on the attacker) and gateway IP (on the victim).

Phase 2: Enabling IP Forwarding (Attacker Machine)

For a successful MitM attack where you want to intercept and forward traffic (rather than just causing a Denial of Service), you must enable IP forwarding on the attacker machine. This allows it to route packets received from the victim to the actual gateway, and vice-versa.

sudo sysctl -w net.ipv4.ip_forward=1

Alternatively, you can edit /etc/sysctl.conf, uncomment net.ipv4.ip_forward=1, and run sudo sysctl -p to make it persistent across reboots.

Phase 3: Launching the ARP Poisoning Attack

We will use arpspoof. You'll need two terminals on the attacker machine: one to poison the victim's ARP cache regarding the gateway, and another to poison the gateway's ARP cache regarding the victim.

1. Poison the Victim's ARP Cache (Terminal 1 - Attacker):

Tell the victim machine that the attacker's MAC address is the MAC address for the gateway's IP.

sudo arpspoof -i wlan0 -t 192.168.1.150 192.168.1.1

  • -i wlan0: Your attacker's wireless interface.
  • -t 192.168.1.150: The IP address of the victim machine.
  • 192.168.1.1: The IP address of the gateway (the IP whose MAC address we are spoofing to the victim).
This command will continuously send ARP replies. Keep this terminal open.

2. Poison the Gateway's ARP Cache (Terminal 2 - Attacker):

Tell the gateway that the attacker's MAC address is the MAC address for the victim's IP.

sudo arpspoof -i wlan0 -t 192.168.1.1 192.168.1.150

  • -t 192.168.1.1: The IP address of the gateway.
  • 192.168.1.150: The IP address of the victim (the IP whose MAC address we are spoofing to the gateway).
Keep this terminal open.

3. Verify ARP Cache Corruption (Optional - During Attack):

On the Victim Machine, check its ARP cache again:

arp -n

You should now see that the MAC address associated with the gateway's IP (192.168.1.1) is the MAC address of your attacker machine (wlan0).

On the Attacker Machine, if you could check the gateway's ARP cache (usually not directly possible without admin access to router), it would show the attacker's MAC for the victim's IP.

Phase 4: Traffic Interception & Analysis

1. Sniff Traffic with Wireshark (Terminal 3 - Attacker Machine):

Now that traffic between the victim and the gateway is flowing through your attacker machine, you can capture it.

sudo wireshark

Start capturing on your attacker's wireless interface (wlan0).

2. Generate Traffic (Victim Machine):

On the victim machine, browse the internet. Specifically, try to:

  • Visit HTTP (not HTTPS) websites.
  • Log in to a test website that uses HTTP for its login form (if available).
  • Perform DNS lookups (e.g., by visiting new websites).

3. Observe Intercepted Traffic (Wireshark on Attacker Machine):

In Wireshark, you should see traffic from the victim's IP address (192.168.1.150) going to various internet destinations, and replies coming back.

  • Apply display filters in Wireshark, e.g.:
    • ip.addr == 192.168.1.150 (to see all traffic to/from victim)
    • http (to see unencrypted HTTP traffic)
    • dns (to see DNS queries)
  • Look for sensitive information if any HTTP sites were accessed, such as usernames, passwords, or cookies transmitted in clear text.

SSL/TLS: HTTPS traffic will still be encrypted. ARP poisoning itself does not break SSL/TLS. To decrypt HTTPS, an attacker would need to combine ARP poisoning with other techniques like SSL stripping (e.g., using sslstrip or Bettercap's capabilities), which often involves setting up a proxy and tricking the browser into connecting via HTTP or accepting a fake SSL certificate. This is a more advanced topic.
Phase 5: Stopping the Attack & Cleanup

1. Stop arpspoof Processes:

Go to the two terminals where arpspoof is running and press Ctrl+C in each to stop sending malicious ARP packets.

2. Stop Wireshark Capture.

3. Disable IP Forwarding (Attacker Machine):

sudo sysctl -w net.ipv4.ip_forward=0

4. Verify ARP Cache Restoration:

After a short while, the ARP caches on the victim machine and the gateway should revert to normal (or they will re-learn the correct MAC addresses through legitimate ARP requests). You can verify this by running arp -n on the victim machine again. The gateway's IP should now be associated with its real MAC address.

Restoring ARP Cache: Sometimes, explicitly sending correct ARP packets might be needed to quickly restore the cache, or devices might take a few minutes to time out the poisoned entries. Rebooting the victim machine or disconnecting/reconnecting it to the network will also clear its ARP cache.

Discussion Points & Observations

  • How did the ARP cache on the victim machine change after the attack started?
  • What types of unencrypted traffic were you able to observe in Wireshark?
  • Why is IP forwarding necessary on the attacker machine for this MitM attack to allow the victim to continue accessing the internet?
  • What would happen if IP forwarding was NOT enabled on the attacker machine? (Denial of Service for the victim).
  • How does HTTPS (SSL/TLS) protect against simple ARP poisoning in terms of data confidentiality?
  • Why is ARP poisoning effective on local networks? (Lack of authentication in ARP).

Countermeasures Against ARP Poisoning

Detection & Prevention:
  • ARP Watch Tools: Software like arpwatch can monitor ARP activity on a network and alert administrators to suspicious changes or multiple MAC addresses claiming the same IP.
  • Dynamic ARP Inspection (DAI): A security feature on many managed switches. DAI intercepts ARP packets, validates them against a trusted database of IP-to-MAC bindings (often derived from DHCP snooping), and drops invalid or malicious ARP packets. This is highly effective but requires switch support.
  • Static ARP Entries: Manually configuring static ARP entries on critical hosts (like servers and gateways) can prevent them from accepting spoofed ARP replies for those specific entries. This is less scalable for many client devices.
  • Intrusion Detection/Prevention Systems (IDS/IPS): Some IDS/IPS can detect patterns indicative of ARP spoofing.
  • Port Security (on Switches): While not directly preventing ARP spoofing logic, port security can limit the number of MAC addresses learned on a port or bind specific MACs to ports, making it harder for an attacker to inject traffic from an unauthorized MAC.
  • Use of Encrypted Protocols: Always prefer secure protocols like HTTPS, SSH, SMTPS, IMAPS, etc., to protect data in transit, even if the underlying network layer is compromised.
  • VPNs: Using a VPN encrypts all traffic from the client to the VPN server, making it unreadable to an ARP spoofer on the local network.

Conclusion

This lab demonstrated a classic Man-in-the-Middle attack using ARP poisoning. It highlights a fundamental vulnerability in the ARP protocol and underscores the importance of defense-in-depth strategies, including network monitoring, switch security features, and consistent use of end-to-end encryption for sensitive communications.

Modules (130) ← CEH — Ethical Hacking