Introduction to Man-in-the-Middle (MITM) Attacks
Man-in-the-Middle (MITM) attacks represent a critical threat vector in network security. These attacks occur
when an adversary positions themselves between two communicating parties, intercepting and potentially
altering the data exchanged.
Key Concept: In a normal network scenario, devices communicate directly with their intended
recipients. During a MITM attack, all traffic is secretly redirected through the attacker's system, giving
them visibility into—and control over—the communication.
Normal Communication vs. MITM Attack
What is ARP Poisoning?
ARP poisoning (also known as ARP spoofing) is one of the most common techniques used to execute MITM
attacks. This method exploits fundamental weaknesses in the Address Resolution Protocol (ARP) to redirect
network traffic through an attacker's device.
Understanding the Address Resolution Protocol (ARP)
Before diving into ARP poisoning, it's essential to understand what ARP is and how it functions in normal
network operations:
- Purpose: ARP translates IP addresses (logical addresses) to MAC addresses (physical
addresses) on local networks.
- Function: When a device needs to communicate with another device on the same network,
it needs to know the recipient's MAC address.
- Process: The sender broadcasts an ARP request asking, "Who has IP address x.x.x.x?" The
device with that IP responds with its MAC address.
ARP Table: Each device maintains an ARP cache or table that maps IP addresses to MAC
addresses. This table is continually updated as new ARP responses are received.
# Example of an ARP table (from Linux/macOS)
$ arp -a
? (10.0.2.1) at 52:54:00:12:35:00 [ether] on eth0
? (10.0.2.6) at 08:00:27:a9:8b:cd [ether] on eth0
# Example of an ARP table (from Windows)
> arp -a
Interface: 10.0.2.7 --- 0x4
Internet Address Physical Address Type
10.0.2.1 52-54-00-12-35-00 dynamic
10.0.2.6 08-00-27-a9-8b-cd dynamic
How ARP Poisoning Works
ARP Poisoning Attack Flow
ARP poisoning follows these general steps:
1
Network Reconnaissance: The attacker identifies target devices on the network,
typically including both a victim device and the default gateway (router).
2
Spoofing the Gateway: The attacker sends a forged ARP response to the victim, claiming
the attacker's MAC address corresponds to the gateway's IP address.
3
Spoofing the Victim: Similarly, the attacker sends a forged ARP response to the
gateway, claiming the attacker's MAC address corresponds to the victim's IP address.
4
Traffic Redirection: After the poisoning, both the victim and gateway update their ARP
tables with the incorrect information. Now all traffic between the victim and gateway flows through the
attacker's machine.
5
Maintaining the Attack: The attacker continuously sends spoofed ARP messages to keep
the poisoned entries in the ARP tables of both devices.
Critical Vulnerabilities in ARP:
- ARP has no authentication mechanism - devices blindly trust received ARP messages
- Devices accept unsolicited ARP responses (no request needed)
- ARP tables are easily overwritten with new information
- There's no verification of the sender's identity
Technical Example of ARP Poisoning Commands
# Enable IP forwarding to allow traffic to flow through the attacker's machine
$ echo 1 > /proc/sys/net/ipv4/ip_forward
# ARP poisoning using arpspoof (from dsniff package)
# Telling the victim (10.0.2.7) that we are the gateway (10.0.2.1)
$ arpspoof -i eth0 -t 10.0.2.7 10.0.2.1
# In another terminal, tell the gateway (10.0.2.1) that we are the victim (10.0.2.7)
$ arpspoof -i eth0 -t 10.0.2.1 10.0.2.7
# Alternatively, using Ettercap
$ ettercap -T -q -M arp:remote /10.0.2.1// /10.0.2.7//
Impact and Risks of ARP Poisoning
Once an attacker successfully performs ARP poisoning, they can execute various malicious activities:
| Attack Type |
Description |
Impact |
| Eavesdropping |
Passive monitoring of unencrypted traffic |
Exposure of sensitive information, credentials, and communications |
| Data Modification |
Altering the content of intercepted packets |
Integrity violation, malicious code injection, fake information delivery |
| Session Hijacking |
Stealing authentication cookies or tokens |
Unauthorized access to user accounts and services |
| SSL Stripping |
Downgrading HTTPS connections to HTTP |
Bypassing encryption to expose sensitive data |
| Denial of Service |
Dropping packets instead of forwarding them |
Network service disruption for targeted victims |
Detecting ARP Poisoning
Several methods can help detect ARP poisoning attacks:
- Monitoring ARP tables: Regularly check for inconsistent or rapidly changing ARP entries
- Network monitoring tools: Solutions like Wireshark can detect unusual ARP traffic
patterns
- Static ARP entries: Important systems can use static, manually configured ARP entries
- IDS/IPS systems: Network security tools can be configured to detect suspicious ARP
behavior
# Example Wireshark filter to detect potential ARP poisoning
arp.duplicate-address-detected or arp.duplicate-address-frame
Mitigation Strategies
To protect against ARP poisoning attacks, consider implementing these countermeasures:
1
Static ARP Entries: Configure static ARP entries for critical network devices.
# Adding a static ARP entry on Linux
$ arp -s 10.0.2.1 52:54:00:12:35:00
# Adding a static ARP entry on Windows
> netsh interface ipv4 add neighbors "Ethernet" 10.0.2.1 52-54-00-12-35-00
2
Packet Filtering: Implement network filtering to block unauthorized ARP packets.
3
Encryption: Use encrypted protocols (HTTPS, SSH, VPN) whenever possible to protect data
even if intercepted.
4
Network Segmentation: Divide networks into smaller segments to limit the impact of ARP
poisoning.
5
ARP Spoofing Detection Tools: Deploy specialized tools that can detect and alert on ARP
spoofing activities.
Enterprise Solutions: Many enterprise-grade switches support features like Dynamic ARP
Inspection (DAI) and DHCP snooping, which can effectively prevent ARP poisoning attacks by validating ARP
packets against trusted databases.
Conclusion
ARP poisoning remains a powerful and prevalent attack vector due to the fundamental security limitations of
the ARP protocol. Understanding how this attack works is essential for network administrators and security
professionals to implement appropriate countermeasures.
While complete prevention is challenging without redesigning the protocol itself, a combination of detection
mechanisms, network segmentation, and encryption can significantly reduce the risk and impact of ARP
poisoning attacks in modern networks.