[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ET8XZP2DHVTN4WS1HZH20Z":3,"skill-same:01M6ET8XZP2DHVTN4WS1HZH20Z":105},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":66,"commitSha":67,"skillDirectory":68,"forksCount":14,"repositoryHtmlUrl":69,"repositoryHomepageUrl":70,"ownerHtmlUrl":71,"ownerBlogUrl":6,"ownerDescription":72,"updatedAt":73,"install":74,"resources":87},"01M6ET8XZP2DHVTN4WS1HZH20Z","detecting-arp-poisoning-in-network-traffic",null,"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.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"network","arp","detecting arp poisoning in network traffic","detect","security","de","scripts","id","man","cm","wireshark analysis","analysis","layer-2-security","man-in-the-middle","mitm","network-security","Wireshark","monitoring","pr","cybersecurity","2026-11-10 10:12:30",false,"---\nname: detecting-arp-poisoning-in-network-traffic\ndescription: Detect and prevent ARP spoofing attacks using ARPWatch, Dynamic ARP Inspection,\n  Wireshark analysis, and custom monitoring scripts to protect against man-in-the-middle\n  interception.\ndomain: cybersecurity\nsubdomain: network-security\ntags:\n- arp-poisoning\n- arp-spoofing\n- mitm\n- dynamic-arp-inspection\n- arpwatch\n- network-security\n- man-in-the-middle\n- layer-2-security\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- DE.CM-01\n- ID.AM-03\n- PR.DS-02\nmitre_attack:\n- T1557.002\n- T1557\n- T1040\n- T1200\n---\n\n# Detecting ARP Poisoning in Network Traffic\n\n## Overview\n\nARP 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.\n\n\n## When to Use\n\n- When investigating security incidents that require detecting arp poisoning in network traffic\n- When building detection rules or threat hunting queries for this domain\n- When SOC analysts need structured procedures for this analysis type\n- When validating security monitoring coverage for related attack techniques\n\n## Prerequisites\n\n- Access to the target network segment (broadcast domain)\n- Linux host for ARPWatch and custom monitoring tools\n- Managed switches supporting Dynamic ARP Inspection (Cisco Catalyst, Aruba, Juniper EX)\n- Wireshark or tcpdump for packet capture\n- DHCP snooping configured (prerequisite for DAI)\n- Network monitoring infrastructure (SIEM, syslog server)\n\n## Core Concepts\n\n### ARP Protocol Fundamentals\n\nARP maps IP addresses to MAC addresses on a local network segment. The protocol operates statelessly with no authentication:\n\n```\nNormal ARP Process:\n1. Host A broadcasts: \"Who has 10.0.1.1? Tell 10.0.1.100\"\n2. Router replies: \"10.0.1.1 is at AA:BB:CC:DD:EE:01\"\n3. Host A caches the mapping\n\nARP Poisoning Attack:\n1. Attacker sends unsolicited ARP reply to Host A:\n   \"10.0.1.1 is at EV:IL:MA:CA:DD:RR\" (attacker's MAC)\n2. Host A updates cache, sends traffic to attacker\n3. Attacker forwards to real gateway (MitM position)\n```\n\n### Attack Indicators\n\n| Indicator | Description | Severity |\n|-----------|-------------|----------|\n| MAC flip-flopping | Same IP mapped to different MACs rapidly | High |\n| Gratuitous ARP flood | Unsolicited ARP replies targeting multiple hosts | High |\n| Duplicate IP address | Two different MACs claiming same IP | Critical |\n| Unusual ARP volume | Spike in ARP packets per second | Medium |\n| ARP from non-DHCP source | Static IP claims from unknown devices | Medium |\n| Gateway MAC change | Default gateway MAC address changed | Critical |\n\n## Workflow\n\n### Step 1: Deploy ARPWatch for Continuous Monitoring\n\n```bash\n# Install ARPWatch\nsudo apt-get install -y arpwatch\n\n# Configure ARPWatch\nsudo vi \u002Fetc\u002Fdefault\u002Farpwatch\n# INTERFACES=\"eth0\"\n# ARGS=\"-N -p -i eth0 -f \u002Fvar\u002Flib\u002Farpwatch\u002Farp.dat\"\n\n# Start monitoring\nsudo systemctl enable arpwatch\nsudo systemctl start arpwatch\n\n# View current ARP database\ncat \u002Fvar\u002Flib\u002Farpwatch\u002Farp.dat\n\n# Monitor logs for changes\ntail -f \u002Fvar\u002Flog\u002Fsyslog | grep arpwatch\n```\n\nARPWatch alert types:\n- **new station** - Previously unseen MAC address\n- **changed ethernet address** - IP mapped to different MAC (potential poisoning)\n- **flip flop** - MAC alternating between two addresses (active attack)\n- **reused old ethernet address** - Previously seen mapping returned\n\n### Step 2: Configure Dynamic ARP Inspection (DAI) on Switches\n\n**Cisco Catalyst configuration:**\n\n```\n! Enable DHCP snooping (prerequisite for DAI)\nip dhcp snooping\nip dhcp snooping vlan 10,20,30\n\n! Configure trusted ports (uplinks, DHCP servers)\ninterface GigabitEthernet1\u002F0\u002F1\n description Uplink to Distribution\n ip dhcp snooping trust\n\ninterface GigabitEthernet1\u002F0\u002F48\n description DHCP Server\n ip dhcp snooping trust\n\n! Enable Dynamic ARP Inspection\nip arp inspection vlan 10,20,30\n\n! Configure trusted ports for DAI\ninterface GigabitEthernet1\u002F0\u002F1\n ip arp inspection trust\n\n! Set rate limits to prevent ARP flood DoS\ninterface range GigabitEthernet1\u002F0\u002F2-47\n ip arp inspection limit rate 15\n\n! Enable additional validation checks\nip arp inspection validate src-mac dst-mac ip\n\n! Configure ARP ACL for static IP devices (servers, printers)\narp access-list STATIC-ARP-ENTRIES\n permit ip host 10.0.10.100 mac host 0011.2233.4455\n permit ip host 10.0.10.101 mac host 0011.2233.4456\n\nip arp inspection filter STATIC-ARP-ENTRIES vlan 10\n\n! Verify DAI status\nshow ip arp inspection vlan 10\nshow ip arp inspection statistics\nshow ip dhcp snooping binding\n```\n\n### Step 3: Wireshark Detection Filters\n\n```\n# Detect gratuitous ARP (sender and target IP are the same)\narp.src.proto_ipv4 == arp.dst.proto_ipv4\n\n# Detect ARP replies (focus on unsolicited)\narp.opcode == 2\n\n# Detect duplicate IP address claims\narp.duplicate-address-detected\n\n# Detect ARP packets from specific attacker MAC\neth.src == ev:il:ma:ca:dd:rr\n\n# Detect ARP storms (high volume)\n# Use Statistics > I\u002FO Graphs > Display filter: arp\n\n# Detect gateway impersonation\narp.src.proto_ipv4 == 10.0.1.1 && arp.src.hw_mac != aa:bb:cc:dd:ee:01\n```\n\n### Step 4: Custom Python ARP Monitor\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nReal-time ARP poisoning detection using packet capture.\nMonitors ARP traffic for spoofing indicators and alerts on anomalies.\n\"\"\"\n\nimport subprocess\nimport sys\nimport json\nimport time\nfrom collections import defaultdict\nfrom datetime import datetime\n\ntry:\n    from scapy.all import sniff, ARP, Ether, get_if_hwaddr, conf\n    SCAPY_AVAILABLE = True\nexcept ImportError:\n    SCAPY_AVAILABLE = False\n\n\nclass ARPPoisonDetector:\n    def __init__(self, interface: str, gateway_ip: str, gateway_mac: str):\n        self.interface = interface\n        self.gateway_ip = gateway_ip\n        self.gateway_mac = gateway_mac.lower()\n        self.arp_table = {}  # IP -> MAC mapping\n        self.arp_history = defaultdict(list)  # IP -> list of (MAC, timestamp)\n        self.alerts = []\n        self.arp_count = defaultdict(int)  # Source MAC -> count per interval\n        self.last_reset = time.time()\n        self.arp_rate_threshold = 50  # ARP packets per 10 seconds\n\n    def alert(self, severity: str, message: str, details: dict):\n        \"\"\"Generate alert for detected anomaly.\"\"\"\n        alert_data = {\n            'timestamp': datetime.now().isoformat(),\n            'severity': severity,\n            'message': message,\n            'details': details,\n        }\n        self.alerts.append(alert_data)\n        print(f\"\\n[{severity}] {datetime.now().strftime('%H:%M:%S')} - {message}\")\n        for key, value in details.items():\n            print(f\"  {key}: {value}\")\n\n    def check_gateway_spoofing(self, src_ip: str, src_mac: str):\n        \"\"\"Check if someone is spoofing the gateway.\"\"\"\n        if src_ip == self.gateway_ip and src_mac != self.gateway_mac:\n            self.alert('CRITICAL', 'Gateway ARP Spoofing Detected', {\n                'gateway_ip': self.gateway_ip,\n                'expected_mac': self.gateway_mac,\n                'spoofed_mac': src_mac,\n                'action': 'Potential MitM attack on default gateway',\n            })\n            return True\n        return False\n\n    def check_mac_change(self, src_ip: str, src_mac: str):\n        \"\"\"Check if IP-to-MAC mapping has changed.\"\"\"\n        if src_ip in self.arp_table:\n            known_mac = self.arp_table[src_ip]\n            if known_mac != src_mac:\n                self.alert('HIGH', 'ARP Cache Poisoning Attempt', {\n                    'ip_address': src_ip,\n                    'previous_mac': known_mac,\n                    'new_mac': src_mac,\n                    'action': 'IP-to-MAC mapping changed unexpectedly',\n                })\n                return True\n        return False\n\n    def check_flip_flop(self, src_ip: str, src_mac: str):\n        \"\"\"Check for MAC address flip-flopping (active attack indicator).\"\"\"\n        self.arp_history[src_ip].append((src_mac, time.time()))\n\n        # Keep only last 60 seconds of history\n        cutoff = time.time() - 60\n        self.arp_history[src_ip] = [\n            (mac, ts) for mac, ts in self.arp_history[src_ip]\n            if ts > cutoff\n        ]\n\n        unique_macs = set(mac for mac, ts in self.arp_history[src_ip])\n        if len(unique_macs) > 2:\n            self.alert('CRITICAL', 'ARP Flip-Flop Detected (Active Attack)', {\n                'ip_address': src_ip,\n                'mac_addresses': list(unique_macs),\n                'changes_in_60s': len(self.arp_history[src_ip]),\n            })\n            return True\n        return False\n\n    def check_arp_rate(self, src_mac: str):\n        \"\"\"Check for ARP flood (DoS or scanning).\"\"\"\n        self.arp_count[src_mac] += 1\n\n        # Reset counters every 10 seconds\n        if time.time() - self.last_reset > 10:\n            for mac, count in self.arp_count.items():\n                if count > self.arp_rate_threshold:\n                    self.alert('MEDIUM', 'ARP Flood Detected', {\n                        'source_mac': mac,\n                        'arp_packets_10s': count,\n                        'threshold': self.arp_rate_threshold,\n                    })\n            self.arp_count.clear()\n            self.last_reset = time.time()\n\n    def process_packet(self, packet):\n        \"\"\"Process captured ARP packet.\"\"\"\n        if not packet.haslayer(ARP):\n            return\n\n        arp = packet[ARP]\n\n        # Only process ARP replies (opcode 2) and requests (opcode 1)\n        if arp.op not in (1, 2):\n            return\n\n        src_ip = arp.psrc\n        src_mac = arp.hwsrc.lower()\n\n        # Run detection checks\n        self.check_gateway_spoofing(src_ip, src_mac)\n        self.check_mac_change(src_ip, src_mac)\n        self.check_flip_flop(src_ip, src_mac)\n        self.check_arp_rate(src_mac)\n\n        # Update ARP table\n        self.arp_table[src_ip] = src_mac\n\n    def start_monitoring(self):\n        \"\"\"Start real-time ARP monitoring.\"\"\"\n        print(f\"[*] Starting ARP Poison Detection on {self.interface}\")\n        print(f\"[*] Gateway: {self.gateway_ip} ({self.gateway_mac})\")\n        print(f\"[*] Monitoring... (Ctrl+C to stop)\\n\")\n\n        if SCAPY_AVAILABLE:\n            sniff(\n                iface=self.interface,\n                filter=\"arp\",\n                prn=self.process_packet,\n                store=False,\n            )\n        else:\n            print(\"[-] Scapy not available. Install with: pip install scapy\")\n            print(\"[*] Falling back to tcpdump-based monitoring...\")\n            self._monitor_with_tcpdump()\n\n    def _monitor_with_tcpdump(self):\n        \"\"\"Fallback monitoring using tcpdump.\"\"\"\n        cmd = ['tcpdump', '-i', self.interface, '-l', '-n', 'arp']\n        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,\n                                stderr=subprocess.DEVNULL, text=True)\n        try:\n            for line in proc.stdout:\n                parts = line.strip().split()\n                if 'is-at' in parts:\n                    try:\n                        ip_idx = parts.index('is-at') - 1\n                        mac_idx = parts.index('is-at') + 1\n                        src_ip = parts[ip_idx]\n                        src_mac = parts[mac_idx].lower()\n                        self.check_gateway_spoofing(src_ip, src_mac)\n                        self.check_mac_change(src_ip, src_mac)\n                        self.arp_table[src_ip] = src_mac\n                    except (IndexError, ValueError):\n                        continue\n        except KeyboardInterrupt:\n            proc.terminate()\n\n    def generate_report(self) -> dict:\n        \"\"\"Generate summary report of detected anomalies.\"\"\"\n        return {\n            'monitoring_interface': self.interface,\n            'gateway': {'ip': self.gateway_ip, 'mac': self.gateway_mac},\n            'total_alerts': len(self.alerts),\n            'arp_table_size': len(self.arp_table),\n            'alerts': self.alerts,\n        }\n\n\nif __name__ == '__main__':\n    if len(sys.argv) \u003C 4:\n        print(\"Usage: python process.py \u003Cinterface> \u003Cgateway_ip> \u003Cgateway_mac>\")\n        print(\"Example: python process.py eth0 10.0.1.1 aa:bb:cc:dd:ee:01\")\n        sys.exit(1)\n\n    detector = ARPPoisonDetector(\n        interface=sys.argv[1],\n        gateway_ip=sys.argv[2],\n        gateway_mac=sys.argv[3],\n    )\n\n    try:\n        detector.start_monitoring()\n    except KeyboardInterrupt:\n        print(\"\\n\\n[*] Monitoring stopped.\")\n        report = detector.generate_report()\n        print(f\"[*] Total alerts generated: {report['total_alerts']}\")\n        print(f\"[*] ARP table entries: {report['arp_table_size']}\")\n```\n\n## Prevention Measures\n\n### Layer 2 Controls\n\n1. **Dynamic ARP Inspection (DAI)** - Validates ARP packets against DHCP snooping binding table\n2. **DHCP Snooping** - Builds trusted IP-MAC-port binding database\n3. **Port Security** - Limits MAC addresses per port\n4. **Private VLANs** - Restricts communication between hosts in the same VLAN\n\n### Network Controls\n\n1. **Static ARP Entries** - For critical infrastructure (gateways, DNS, DHCP)\n2. **Network Segmentation** - Reduce broadcast domain size with VLANs\n3. **802.1X Authentication** - Authenticate devices before network access\n4. **Encrypted Protocols** - Use SSH, HTTPS, TLS to protect data even if intercepted\n\n## Best Practices\n\n- **Defense in Depth** - Combine DAI, ARPWatch, and custom monitoring for comprehensive coverage\n- **DHCP Snooping First** - Always enable DHCP snooping before DAI (DAI depends on snooping database)\n- **Static ARP for Gateways** - Configure static ARP entries on critical servers for the default gateway\n- **Monitor Gratuitous ARP** - Pay special attention to unsolicited ARP replies\n- **Small Broadcast Domains** - Use VLANs to limit the scope of ARP-based attacks\n- **Regular Audits** - Periodically compare ARP tables across devices to identify anomalies\n\n## References\n\n- [NIST SP 800-54 - Border Gateway Protocol Security](https:\u002F\u002Fcsrc.nist.gov\u002Fpublications\u002Fdetail\u002Fsp\u002F800-54\u002Ffinal)\n- [Cisco DAI Configuration Guide](https:\u002F\u002Fwww.cisco.com\u002Fc\u002Fen\u002Fus\u002Ftd\u002Fdocs\u002Fswitches\u002Flan\u002Fcatalyst9300\u002Fsoftware\u002Frelease\u002F16-12\u002Fconfiguration_guide\u002Fsec\u002Fb_1612_sec_9300_cg\u002Fconfiguring_dynamic_arp_inspection.html)\n- [Comparitech ARP Poisoning Guide](https:\u002F\u002Fwww.comparitech.com\u002Fblog\u002Finformation-security\u002Farp-poisoning-spoofing-detect-prevent\u002F)\n- [Okta ARP Poisoning Techniques](https:\u002F\u002Fwww.okta.com\u002Fidentity-101\u002Farp-poisoning\u002F)\n","# Detecting ARP Poisoning in Network Traffic\n\n## Overview\n\nARP 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.\n\n\n## When to Use\n\n- When investigating security incidents that require detecting arp poisoning in network traffic\n- When building detection rules or threat hunting queries for this domain\n- When SOC analysts need structured procedures for this analysis type\n- When validating security monitoring coverage for related attack techniques\n\n## Prerequisites\n\n- Access to the target network segment (broadcast domain)\n- Linux host for ARPWatch and custom monitoring tools\n- Managed switches supporting Dynamic ARP Inspection (Cisco Catalyst, Aruba, Juniper EX)\n- Wireshark or tcpdump for packet capture\n- DHCP snooping configured (prerequisite for DAI)\n- Network monitoring infrastructure (SIEM, syslog server)\n\n## Core Concepts\n\n### ARP Protocol Fundamentals\n\nARP maps IP addresses to MAC addresses on a local network segment. The protocol operates statelessly with no authentication:\n\n```\nNormal ARP Process:\n1. Host A broadcasts: \"Who has 10.0.1.1? Tell 10.0.1.100\"\n2. Router replies: \"10.0.1.1 is at AA:BB:CC:DD:EE:01\"\n3. Host A caches the mapping\n\nARP Poisoning Attack:\n1. Attacker sends unsolicited ARP reply to Host A:\n   \"10.0.1.1 is at EV:IL:MA:CA:DD:RR\" (attacker's MAC)\n2. Host A updates cache, sends traffic to attacker\n3. Attacker forwards to real gateway (MitM position)\n```\n\n### Attack Indicators\n\n| Indicator | Description | Severity |\n|-----------|-------------|----------|\n| MAC flip-flopping | Same IP mapped to different MACs rapidly | High |\n| Gratuitous ARP flood | Unsolicited ARP replies targeting multiple hosts | High |\n| Duplicate IP address | Two different MACs claiming same IP | Critical |\n| Unusual ARP volume | Spike in ARP packets per second | Medium |\n| ARP from non-DHCP source | Static IP claims from unknown devices | Medium |\n| Gateway MAC change | Default gateway MAC address changed | Critical |\n\n## Workflow\n\n### Step 1: Deploy ARPWatch for Continuous Monitoring\n\n```bash\n# Install ARPWatch\nsudo apt-get install -y arpwatch\n\n# Configure ARPWatch\nsudo vi \u002Fetc\u002Fdefault\u002Farpwatch\n# INTERFACES=\"eth0\"\n# ARGS=\"-N -p -i eth0 -f \u002Fvar\u002Flib\u002Farpwatch\u002Farp.dat\"\n\n# Start monitoring\nsudo systemctl enable arpwatch\nsudo systemctl start arpwatch\n\n# View current ARP database\ncat \u002Fvar\u002Flib\u002Farpwatch\u002Farp.dat\n\n# Monitor logs for changes\ntail -f \u002Fvar\u002Flog\u002Fsyslog | grep arpwatch\n```\n\nARPWatch alert types:\n- **new station** - Previously unseen MAC address\n- **changed ethernet address** - IP mapped to different MAC (potential poisoning)\n- **flip flop** - MAC alternating between two addresses (active attack)\n- **reused old ethernet address** - Previously seen mapping returned\n\n### Step 2: Configure Dynamic ARP Inspection (DAI) on Switches\n\n**Cisco Catalyst configuration:**\n\n```\n! Enable DHCP snooping (prerequisite for DAI)\nip dhcp snooping\nip dhcp snooping vlan 10,20,30\n\n! Configure trusted ports (uplinks, DHCP servers)\ninterface GigabitEthernet1\u002F0\u002F1\n description Uplink to Distribution\n ip dhcp snooping trust\n\ninterface GigabitEthernet1\u002F0\u002F48\n description DHCP Server\n ip dhcp snooping trust\n\n! Enable Dynamic ARP Inspection\nip arp inspection vlan 10,20,30\n\n! Configure trusted ports for DAI\ninterface GigabitEthernet1\u002F0\u002F1\n ip arp inspection trust\n\n! Set rate limits to prevent ARP flood DoS\ninterface range GigabitEthernet1\u002F0\u002F2-47\n ip arp inspection limit rate 15\n\n! Enable additional validation checks\nip arp inspection validate src-mac dst-mac ip\n\n! Configure ARP ACL for static IP devices (servers, printers)\narp access-list STATIC-ARP-ENTRIES\n permit ip host 10.0.10.100 mac host 0011.2233.4455\n permit ip host 10.0.10.101 mac host 0011.2233.4456\n\nip arp inspection filter STATIC-ARP-ENTRIES vlan 10\n\n! Verify DAI status\nshow ip arp inspection vlan 10\nshow ip arp inspection statistics\nshow ip dhcp snooping binding\n```\n\n### Step 3: Wireshark Detection Filters\n\n```\n# Detect gratuitous ARP (sender and target IP are the same)\narp.src.proto_ipv4 == arp.dst.proto_ipv4\n\n# Detect ARP replies (focus on unsolicited)\narp.opcode == 2\n\n# Detect duplicate IP address claims\narp.duplicate-address-detected\n\n# Detect ARP packets from specific attacker MAC\neth.src == ev:il:ma:ca:dd:rr\n\n# Detect ARP storms (high volume)\n# Use Statistics > I\u002FO Graphs > Display filter: arp\n\n# Detect gateway impersonation\narp.src.proto_ipv4 == 10.0.1.1 && arp.src.hw_mac != aa:bb:cc:dd:ee:01\n```\n\n### Step 4: Custom Python ARP Monitor\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"\nReal-time ARP poisoning detection using packet capture.\nMonitors ARP traffic for spoofing indicators and alerts on anomalies.\n\"\"\"\n\nimport subprocess\nimport sys\nimport json\nimport time\nfrom collections import defaultdict\nfrom datetime import datetime\n\ntry:\n    from scapy.all import sniff, ARP, Ether, get_if_hwaddr, conf\n    SCAPY_AVAILABLE = True\nexcept ImportError:\n    SCAPY_AVAILABLE = False\n\n\nclass ARPPoisonDetector:\n    def __init__(self, interface: str, gateway_ip: str, gateway_mac: str):\n        self.interface = interface\n        self.gateway_ip = gateway_ip\n        self.gateway_mac = gateway_mac.lower()\n        self.arp_table = {}  # IP -> MAC mapping\n        self.arp_history = defaultdict(list)  # IP -> list of (MAC, timestamp)\n        self.alerts = []\n        self.arp_count = defaultdict(int)  # Source MAC -> count per interval\n        self.last_reset = time.time()\n        self.arp_rate_threshold = 50  # ARP packets per 10 seconds\n\n    def alert(self, severity: str, message: str, details: dict):\n        \"\"\"Generate alert for detected anomaly.\"\"\"\n        alert_data = {\n            'timestamp': datetime.now().isoformat(),\n            'severity': severity,\n            'message': message,\n            'details': details,\n        }\n        self.alerts.append(alert_data)\n        print(f\"\\n[{severity}] {datetime.now().strftime('%H:%M:%S')} - {message}\")\n        for key, value in details.items():\n            print(f\"  {key}: {value}\")\n\n    def check_gateway_spoofing(self, src_ip: str, src_mac: str):\n        \"\"\"Check if someone is spoofing the gateway.\"\"\"\n        if src_ip == self.gateway_ip and src_mac != self.gateway_mac:\n            self.alert('CRITICAL', 'Gateway ARP Spoofing Detected', {\n                'gateway_ip': self.gateway_ip,\n                'expected_mac': self.gateway_mac,\n                'spoofed_mac': src_mac,\n                'action': 'Potential MitM attack on default gateway',\n            })\n            return True\n        return False\n\n    def check_mac_change(self, src_ip: str, src_mac: str):\n        \"\"\"Check if IP-to-MAC mapping has changed.\"\"\"\n        if src_ip in self.arp_table:\n            known_mac = self.arp_table[src_ip]\n            if known_mac != src_mac:\n                self.alert('HIGH', 'ARP Cache Poisoning Attempt', {\n                    'ip_address': src_ip,\n                    'previous_mac': known_mac,\n                    'new_mac': src_mac,\n                    'action': 'IP-to-MAC mapping changed unexpectedly',\n                })\n                return True\n        return False\n\n    def check_flip_flop(self, src_ip: str, src_mac: str):\n        \"\"\"Check for MAC address flip-flopping (active attack indicator).\"\"\"\n        self.arp_history[src_ip].append((src_mac, time.time()))\n\n        # Keep only last 60 seconds of history\n        cutoff = time.time() - 60\n        self.arp_history[src_ip] = [\n            (mac, ts) for mac, ts in self.arp_history[src_ip]\n            if ts > cutoff\n        ]\n\n        unique_macs = set(mac for mac, ts in self.arp_history[src_ip])\n        if len(unique_macs) > 2:\n            self.alert('CRITICAL', 'ARP Flip-Flop Detected (Active Attack)', {\n                'ip_address': src_ip,\n                'mac_addresses': list(unique_macs),\n                'changes_in_60s': len(self.arp_history[src_ip]),\n            })\n            return True\n        return False\n\n    def check_arp_rate(self, src_mac: str):\n        \"\"\"Check for ARP flood (DoS or scanning).\"\"\"\n        self.arp_count[src_mac] += 1\n\n        # Reset counters every 10 seconds\n        if time.time() - self.last_reset > 10:\n            for mac, count in self.arp_count.items():\n                if count > self.arp_rate_threshold:\n                    self.alert('MEDIUM', 'ARP Flood Detected', {\n                        'source_mac': mac,\n                        'arp_packets_10s': count,\n                        'threshold': self.arp_rate_threshold,\n                    })\n            self.arp_count.clear()\n            self.last_reset = time.time()\n\n    def process_packet(self, packet):\n        \"\"\"Process captured ARP packet.\"\"\"\n        if not packet.haslayer(ARP):\n            return\n\n        arp = packet[ARP]\n\n        # Only process ARP replies (opcode 2) and requests (opcode 1)\n        if arp.op not in (1, 2):\n            return\n\n        src_ip = arp.psrc\n        src_mac = arp.hwsrc.lower()\n\n        # Run detection checks\n        self.check_gateway_spoofing(src_ip, src_mac)\n        self.check_mac_change(src_ip, src_mac)\n        self.check_flip_flop(src_ip, src_mac)\n        self.check_arp_rate(src_mac)\n\n        # Update ARP table\n        self.arp_table[src_ip] = src_mac\n\n    def start_monitoring(self):\n        \"\"\"Start real-time ARP monitoring.\"\"\"\n        print(f\"[*] Starting ARP Poison Detection on {self.interface}\")\n        print(f\"[*] Gateway: {self.gateway_ip} ({self.gateway_mac})\")\n        print(f\"[*] Monitoring... (Ctrl+C to stop)\\n\")\n\n        if SCAPY_AVAILABLE:\n            sniff(\n                iface=self.interface,\n                filter=\"arp\",\n                prn=self.process_packet,\n                store=False,\n            )\n        else:\n            print(\"[-] Scapy not available. Install with: pip install scapy\")\n            print(\"[*] Falling back to tcpdump-based monitoring...\")\n            self._monitor_with_tcpdump()\n\n    def _monitor_with_tcpdump(self):\n        \"\"\"Fallback monitoring using tcpdump.\"\"\"\n        cmd = ['tcpdump', '-i', self.interface, '-l', '-n', 'arp']\n        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,\n                                stderr=subprocess.DEVNULL, text=True)\n        try:\n            for line in proc.stdout:\n                parts = line.strip().split()\n                if 'is-at' in parts:\n                    try:\n                        ip_idx = parts.index('is-at') - 1\n                        mac_idx = parts.index('is-at') + 1\n                        src_ip = parts[ip_idx]\n                        src_mac = parts[mac_idx].lower()\n                        self.check_gateway_spoofing(src_ip, src_mac)\n                        self.check_mac_change(src_ip, src_mac)\n                        self.arp_table[src_ip] = src_mac\n                    except (IndexError, ValueError):\n                        continue\n        except KeyboardInterrupt:\n            proc.terminate()\n\n    def generate_report(self) -> dict:\n        \"\"\"Generate summary report of detected anomalies.\"\"\"\n        return {\n            'monitoring_interface': self.interface,\n            'gateway': {'ip': self.gateway_ip, 'mac': self.gateway_mac},\n            'total_alerts': len(self.alerts),\n            'arp_table_size': len(self.arp_table),\n            'alerts': self.alerts,\n        }\n\n\nif __name__ == '__main__':\n    if len(sys.argv) \u003C 4:\n        print(\"Usage: python process.py \u003Cinterface> \u003Cgateway_ip> \u003Cgateway_mac>\")\n        print(\"Example: python process.py eth0 10.0.1.1 aa:bb:cc:dd:ee:01\")\n        sys.exit(1)\n\n    detector = ARPPoisonDetector(\n        interface=sys.argv[1],\n        gateway_ip=sys.argv[2],\n        gateway_mac=sys.argv[3],\n    )\n\n    try:\n        detector.start_monitoring()\n    except KeyboardInterrupt:\n        print(\"\\n\\n[*] Monitoring stopped.\")\n        report = detector.generate_report()\n        print(f\"[*] Total alerts generated: {report['total_alerts']}\")\n        print(f\"[*] ARP table entries: {report['arp_table_size']}\")\n```\n\n## Prevention Measures\n\n### Layer 2 Controls\n\n1. **Dynamic ARP Inspection (DAI)** - Validates ARP packets against DHCP snooping binding table\n2. **DHCP Snooping** - Builds trusted IP-MAC-port binding database\n3. **Port Security** - Limits MAC addresses per port\n4. **Private VLANs** - Restricts communication between hosts in the same VLAN\n\n### Network Controls\n\n1. **Static ARP Entries** - For critical infrastructure (gateways, DNS, DHCP)\n2. **Network Segmentation** - Reduce broadcast domain size with VLANs\n3. **802.1X Authentication** - Authenticate devices before network access\n4. **Encrypted Protocols** - Use SSH, HTTPS, TLS to protect data even if intercepted\n\n## Best Practices\n\n- **Defense in Depth** - Combine DAI, ARPWatch, and custom monitoring for comprehensive coverage\n- **DHCP Snooping First** - Always enable DHCP snooping before DAI (DAI depends on snooping database)\n- **Static ARP for Gateways** - Configure static ARP entries on critical servers for the default gateway\n- **Monitor Gratuitous ARP** - Pay special attention to unsolicited ARP replies\n- **Small Broadcast Domains** - Use VLANs to limit the scope of ARP-based attacks\n- **Regular Audits** - Periodically compare ARP tables across devices to identify anomalies\n\n## References\n\n- [NIST SP 800-54 - Border Gateway Protocol Security](https:\u002F\u002Fcsrc.nist.gov\u002Fpublications\u002Fdetail\u002Fsp\u002F800-54\u002Ffinal)\n- [Cisco DAI Configuration Guide](https:\u002F\u002Fwww.cisco.com\u002Fc\u002Fen\u002Fus\u002Ftd\u002Fdocs\u002Fswitches\u002Flan\u002Fcatalyst9300\u002Fsoftware\u002Frelease\u002F16-12\u002Fconfiguration_guide\u002Fsec\u002Fb_1612_sec_9300_cg\u002Fconfiguring_dynamic_arp_inspection.html)\n- [Comparitech ARP Poisoning Guide](https:\u002F\u002Fwww.comparitech.com\u002Fblog\u002Finformation-security\u002Farp-poisoning-spoofing-detect-prevent\u002F)\n- [Okta ARP Poisoning Techniques](https:\u002F\u002Fwww.okta.com\u002Fidentity-101\u002Farp-poisoning\u002F)\n",{"name":5,"tags":49,"author":54,"domain":43,"license":15,"version":55,"nist_csf":56,"subdomain":39,"description":7,"mitre_attack":61},[50,51,38,52,53,39,37,36],"arp-poisoning","arp-spoofing","dynamic-arp-inspection","arpwatch","mahipal","1.0",[57,58,59,60],"PR.IR-01","DE.CM-01","ID.AM-03","PR.DS-02",[62,63,64,65],"T1557.002","T1557","T1040","T1200","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":75,"prompt":85,"zipAvailable":86},[76,79,82],{"tool":77,"command":78},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill detecting-arp-poisoning-in-network-traffic",{"tool":80,"command":81},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill detecting-arp-poisoning-in-network-traffic",{"tool":83,"command":84},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill detecting-arp-poisoning-in-network-traffic","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic\u002FSKILL.md",true,[88,93,99],{"path":89,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic\u002FLICENSE",{"path":94,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"references\u002Fapi-reference.md","REFERENCE","参考文档",1759,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic\u002Freferences\u002Fapi-reference.md",{"path":100,"resourceType":101,"resourceTypeDesc":102,"sizeBytes":103,"sourceHtmlUrl":104},"scripts\u002Fagent.py","SCRIPT","脚本",7137,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdetecting-arp-poisoning-in-network-traffic\u002Fscripts\u002Fagent.py",[106,147,156,165,187,212],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":127,"publishedAt":44},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[113,116,119,122],{"categoryNo":114,"categoryName":115,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":117,"categoryName":118,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[108,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube","with",{"skillNo":148,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":155,"publishedAt":44},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[151,152,153,154],{"categoryNo":114,"categoryName":115,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":117,"categoryName":118,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},[108,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],{"skillNo":157,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":164,"publishedAt":44},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[160,161,162,163],{"categoryNo":114,"categoryName":115,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":117,"categoryName":118,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":123,"categoryName":124,"taxonomyType":125,"taxonomyTypeDesc":126},[108,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146],{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":44},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[172,173,174,175,176,177,178,179,180,181,182,183,184,185,186],"python","zarr python","storage","integration","s3","gcs","cloud","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":191,"categories":192,"keywords":194,"publishedAt":44},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[193],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[195,196,197,198,199,200,35,201,202,203,204,139,140,205,206,207,208,209,210,211],"oracle","what if oracle","go","run","ux","futures","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":213,"name":214,"nameZh":6,"description":215,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":110,"licenseFileUrl":6,"sourceHtmlUrl":216,"categories":217,"keywords":228,"publishedAt":44},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[218,221,224,225],{"categoryNo":219,"categoryName":220,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":222,"categoryName":223,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":226,"categoryName":227,"taxonomyType":125,"taxonomyTypeDesc":126},"01JBSEEDCAT000000000000036","内容创作者",[229,230,231,232,233,234,235,236,136,237,139,140,141,238,239,240,241,242,186,243],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]