- Add validated mitre_attack frontmatter to all 754 skills (286 distinct
techniques), verified against MITRE ATT&CK v19.1 via the official
mitreattack-python library: 0 revoked, deprecated, or invalid IDs
- Curate precise per-skill technique IDs for forensics, malware-analysis,
threat-intel, and red-team skills (e.g. DCSync -> T1003.006,
Kerberoasting -> T1558.003, Pass-the-Ticket -> T1550.003)
- Reconcile v19.1 tactic restructuring: Defense Evasion split into
Stealth (TA0005) and Defense Impairment (TA0112); revoked T1562.*
family and T1070.001/.002 remapped to active equivalents (T1685.*)
- Normalize word-split tags across 35 skills (remove filename-derived
stopword tags, add semantic cybersecurity tags)
- Add api-reference.md for 3 skills that were missing it
- Update README ATT&CK section with accurate v19.1 tactic distribution
Detect and prevent ARP spoofing attacks using ARPWatch, Dynamic ARP Inspection, Wireshark analysis, and custom monitoring scripts to protect against man-in-the-middle interception.
cybersecurity
network-security
arp-poisoning
arp-spoofing
mitm
dynamic-arp-inspection
arpwatch
network-security
man-in-the-middle
layer-2-security
1.0
mahipal
Apache-2.0
PR.IR-01
DE.CM-01
ID.AM-03
PR.DS-02
T1557.002
T1557
T1040
T1200
Detecting ARP Poisoning in Network Traffic
Overview
ARP poisoning (ARP spoofing) is a Layer 2 attack where an adversary sends falsified ARP messages to associate their MAC address with the IP address of a legitimate host, enabling man-in-the-middle (MitM) interception, session hijacking, or denial of service. Since ARP has no built-in authentication mechanism, any device on a broadcast domain can forge ARP replies. Detection requires monitoring ARP traffic for anomalies such as gratuitous ARP floods, IP-to-MAC mapping changes, and duplicate IP addresses. This skill covers deploying multiple detection layers including ARPWatch, Dynamic ARP Inspection (DAI), Wireshark-based analysis, and custom Python monitoring tools.
When to Use
When investigating security incidents that require detecting arp poisoning in network traffic
When building detection rules or threat hunting queries for this domain
When SOC analysts need structured procedures for this analysis type
When validating security monitoring coverage for related attack techniques
Prerequisites
Access to the target network segment (broadcast domain)
Linux host for ARPWatch and custom monitoring tools
ARP maps IP addresses to MAC addresses on a local network segment. The protocol operates statelessly with no authentication:
Normal ARP Process:
1. Host A broadcasts: "Who has 10.0.1.1? Tell 10.0.1.100"
2. Router replies: "10.0.1.1 is at AA:BB:CC:DD:EE:01"
3. Host A caches the mapping
ARP Poisoning Attack:
1. Attacker sends unsolicited ARP reply to Host A:
"10.0.1.1 is at EV:IL:MA:CA:DD:RR" (attacker's MAC)
2. Host A updates cache, sends traffic to attacker
3. Attacker forwards to real gateway (MitM position)
changed ethernet address - IP mapped to different MAC (potential poisoning)
flip flop - MAC alternating between two addresses (active attack)
reused old ethernet address - Previously seen mapping returned
Step 2: Configure Dynamic ARP Inspection (DAI) on Switches
Cisco Catalyst configuration:
! Enable DHCP snooping (prerequisite for DAI)
ip dhcp snooping
ip dhcp snooping vlan 10,20,30
! Configure trusted ports (uplinks, DHCP servers)
interface GigabitEthernet1/0/1
description Uplink to Distribution
ip dhcp snooping trust
interface GigabitEthernet1/0/48
description DHCP Server
ip dhcp snooping trust
! Enable Dynamic ARP Inspection
ip arp inspection vlan 10,20,30
! Configure trusted ports for DAI
interface GigabitEthernet1/0/1
ip arp inspection trust
! Set rate limits to prevent ARP flood DoS
interface range GigabitEthernet1/0/2-47
ip arp inspection limit rate 15
! Enable additional validation checks
ip arp inspection validate src-mac dst-mac ip
! Configure ARP ACL for static IP devices (servers, printers)
arp access-list STATIC-ARP-ENTRIES
permit ip host 10.0.10.100 mac host 0011.2233.4455
permit ip host 10.0.10.101 mac host 0011.2233.4456
ip arp inspection filter STATIC-ARP-ENTRIES vlan 10
! Verify DAI status
show ip arp inspection vlan 10
show ip arp inspection statistics
show ip dhcp snooping binding
Step 3: Wireshark Detection Filters
# Detect gratuitous ARP (sender and target IP are the same)
arp.src.proto_ipv4 == arp.dst.proto_ipv4
# Detect ARP replies (focus on unsolicited)
arp.opcode == 2
# Detect duplicate IP address claims
arp.duplicate-address-detected
# Detect ARP packets from specific attacker MAC
eth.src == ev:il:ma:ca:dd:rr
# Detect ARP storms (high volume)
# Use Statistics > I/O Graphs > Display filter: arp
# Detect gateway impersonation
arp.src.proto_ipv4 == 10.0.1.1 && arp.src.hw_mac != aa:bb:cc:dd:ee:01
Step 4: Custom Python ARP Monitor
#!/usr/bin/env python3"""
Real-time ARP poisoning detection using packet capture.
Monitors ARP traffic for spoofing indicators and alerts on anomalies.
"""importsubprocessimportsysimportjsonimporttimefromcollectionsimportdefaultdictfromdatetimeimportdatetimetry:fromscapy.allimportsniff,ARP,Ether,get_if_hwaddr,confSCAPY_AVAILABLE=TrueexceptImportError:SCAPY_AVAILABLE=FalseclassARPPoisonDetector:def__init__(self,interface:str,gateway_ip:str,gateway_mac:str):self.interface=interfaceself.gateway_ip=gateway_ipself.gateway_mac=gateway_mac.lower()self.arp_table={}# IP -> MAC mappingself.arp_history=defaultdict(list)# IP -> list of (MAC, timestamp)self.alerts=[]self.arp_count=defaultdict(int)# Source MAC -> count per intervalself.last_reset=time.time()self.arp_rate_threshold=50# ARP packets per 10 secondsdefalert(self,severity:str,message:str,details:dict):"""Generate alert for detected anomaly."""alert_data={'timestamp':datetime.now().isoformat(),'severity':severity,'message':message,'details':details,}self.alerts.append(alert_data)print(f"\n[{severity}] {datetime.now().strftime('%H:%M:%S')} - {message}")forkey,valueindetails.items():print(f" {key}: {value}")defcheck_gateway_spoofing(self,src_ip:str,src_mac:str):"""Check if someone is spoofing the gateway."""ifsrc_ip==self.gateway_ipandsrc_mac!=self.gateway_mac:self.alert('CRITICAL','Gateway ARP Spoofing Detected',{'gateway_ip':self.gateway_ip,'expected_mac':self.gateway_mac,'spoofed_mac':src_mac,'action':'Potential MitM attack on default gateway',})returnTruereturnFalsedefcheck_mac_change(self,src_ip:str,src_mac:str):"""Check if IP-to-MAC mapping has changed."""ifsrc_ipinself.arp_table:known_mac=self.arp_table[src_ip]ifknown_mac!=src_mac:self.alert('HIGH','ARP Cache Poisoning Attempt',{'ip_address':src_ip,'previous_mac':known_mac,'new_mac':src_mac,'action':'IP-to-MAC mapping changed unexpectedly',})returnTruereturnFalsedefcheck_flip_flop(self,src_ip:str,src_mac:str):"""Check for MAC address flip-flopping (active attack indicator)."""self.arp_history[src_ip].append((src_mac,time.time()))# Keep only last 60 seconds of historycutoff=time.time()-60self.arp_history[src_ip]=[(mac,ts)formac,tsinself.arp_history[src_ip]ifts>cutoff]unique_macs=set(macformac,tsinself.arp_history[src_ip])iflen(unique_macs)>2:self.alert('CRITICAL','ARP Flip-Flop Detected (Active Attack)',{'ip_address':src_ip,'mac_addresses':list(unique_macs),'changes_in_60s':len(self.arp_history[src_ip]),})returnTruereturnFalsedefcheck_arp_rate(self,src_mac:str):"""Check for ARP flood (DoS or scanning)."""self.arp_count[src_mac]+=1# Reset counters every 10 secondsiftime.time()-self.last_reset>10:formac,countinself.arp_count.items():ifcount>self.arp_rate_threshold:self.alert('MEDIUM','ARP Flood Detected',{'source_mac':mac,'arp_packets_10s':count,'threshold':self.arp_rate_threshold,})self.arp_count.clear()self.last_reset=time.time()defprocess_packet(self,packet):"""Process captured ARP packet."""ifnotpacket.haslayer(ARP):returnarp=packet[ARP]# Only process ARP replies (opcode 2) and requests (opcode 1)ifarp.opnotin(1,2):returnsrc_ip=arp.psrcsrc_mac=arp.hwsrc.lower()# Run detection checksself.check_gateway_spoofing(src_ip,src_mac)self.check_mac_change(src_ip,src_mac)self.check_flip_flop(src_ip,src_mac)self.check_arp_rate(src_mac)# Update ARP tableself.arp_table[src_ip]=src_macdefstart_monitoring(self):"""Start real-time ARP monitoring."""print(f"[*] Starting ARP Poison Detection on {self.interface}")print(f"[*] Gateway: {self.gateway_ip} ({self.gateway_mac})")print(f"[*] Monitoring... (Ctrl+C to stop)\n")ifSCAPY_AVAILABLE:sniff(iface=self.interface,filter="arp",prn=self.process_packet,store=False,)else:print("[-] Scapy not available. Install with: pip install scapy")print("[*] Falling back to tcpdump-based monitoring...")self._monitor_with_tcpdump()def_monitor_with_tcpdump(self):"""Fallback monitoring using tcpdump."""cmd=['tcpdump','-i',self.interface,'-l','-n','arp']proc=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.DEVNULL,text=True)try:forlineinproc.stdout:parts=line.strip().split()if'is-at'inparts:try:ip_idx=parts.index('is-at')-1mac_idx=parts.index('is-at')+1src_ip=parts[ip_idx]src_mac=parts[mac_idx].lower()self.check_gateway_spoofing(src_ip,src_mac)self.check_mac_change(src_ip,src_mac)self.arp_table[src_ip]=src_macexcept(IndexError,ValueError):continueexceptKeyboardInterrupt:proc.terminate()defgenerate_report(self)->dict:"""Generate summary report of detected anomalies."""return{'monitoring_interface':self.interface,'gateway':{'ip':self.gateway_ip,'mac':self.gateway_mac},'total_alerts':len(self.alerts),'arp_table_size':len(self.arp_table),'alerts':self.alerts,}if__name__=='__main__':iflen(sys.argv)<4:print("Usage: python process.py <interface> <gateway_ip> <gateway_mac>")print("Example: python process.py eth0 10.0.1.1 aa:bb:cc:dd:ee:01")sys.exit(1)detector=ARPPoisonDetector(interface=sys.argv[1],gateway_ip=sys.argv[2],gateway_mac=sys.argv[3],)try:detector.start_monitoring()exceptKeyboardInterrupt:print("\n\n[*] Monitoring stopped.")report=detector.generate_report()print(f"[*] Total alerts generated: {report['total_alerts']}")print(f"[*] ARP table entries: {report['arp_table_size']}")