Sniffing Attack
Table of Contents
Capturing network traffic not intended for the attacker's device. On hub-based or wireless networks, this is passive — the attacker simply listens. On switched networks, active techniques are needed to redirect traffic through the attacker.
Related: ARP Poisoning Man-in-the-Middle Attack Wireshark Network Traffic Analysis Switch
Passive vs Active
| Passive | Active | |
|---|---|---|
| Interaction | None — listen only | Injects traffic to redirect |
| Detection risk | Very low | Higher — generates anomalous traffic |
| Works on | Hubs, wireless (shared medium) | Switched networks |
| Techniques | Promiscuous mode capture | ARP poisoning, MAC flooding, DNS spoofing |
Active Techniques
ARP Poisoning / ARP Spoofing
Sends forged ARP replies associating the attacker's MAC with the gateway's IP. Traffic from victims intended for the gateway flows through the attacker instead. See ARP Poisoning.
# Ettercap — ARP poisoning between victim and gateway ettercap -T -M arp:remote /$VICTIM_IP// /$GATEWAY_IP// # arpspoof (dsniff package) echo 1 > /proc/sys/net/ipv4/ip_forward # enable forwarding arpspoof -i eth0 -t $VICTIM_IP $GATEWAY_IP arpspoof -i eth0 -t $GATEWAY_IP $VICTIM_IP
MAC Flooding
Floods the switch CAM table with random MAC addresses until it overflows. The switch degrades to hub behaviour — broadcasting all traffic to all ports. See Switch for CAM table detail.
# macof (dsniff package) macof -i eth0
DNS Spoofing
Injects forged DNS responses to redirect a victim's domain lookups to attacker-controlled IPs. Often chained after ARP poisoning — intercept DNS queries and reply with false records.
Capture Tools
# Wireshark — GUI capture and analysis # Set interface to promiscuous mode in capture settings # tcpdump — command line tcpdump -i eth0 # capture all traffic tcpdump -i eth0 -w capture.pcap # write to file tcpdump -i eth0 host 192.168.1.10 # filter by host tcpdump -i eth0 port 80 # filter by port tcpdump -i eth0 not port 22 # exclude SSH # Read a capture file tcpdump -r capture.pcap tcpdump -r capture.pcap -A | grep -i password # look for cleartext creds
What Gets Captured
On an unencrypted network, sniffing can recover:
— HTTP credentials (POST bodies, Basic Auth headers) — FTP/Telnet/POP3 credentials (cleartext protocols) — Email contents over unencrypted SMTP/IMAP — Session cookies (allowing session hijacking) — DNS queries (reveals browsing activity even over HTTPS) — NTLM hashes over SMB (crackable or relay attack) — Kerberos tickets
Detection
# Detect hosts in promiscuous mode (sends gratuitous ARP) nmap --script sniffer-detect $SUBNET # Detect ARP poisoning arp -a # check ARP table for duplicate MACs arping $GATEWAY_IP # compare responses # Wireshark — detect duplicate IPs # Filter: arp.duplicate-address-detected
Mitigations
| Control | What it addresses |
|---|---|
| TLS/HTTPS everywhere | Makes captured traffic unreadable |
| Dynamic ARP Inspection (DAI) | Switch feature — validates ARP packets against DHCP table |
| Port security | Limits MACs per port — defeats MAC flooding |
| 802.1X | Authenticates devices before allowing network access |
| Network segmentation | Limits scope of what can be sniffed |
| Encrypted DNS (DoH/DoT) | Hides DNS queries from on-path observer |
| WPA3 | Per-session encryption on wireless — defeats passive Wi-Fi sniffing |
Tips
- Cleartext protocols (HTTP, FTP, Telnet, POP3, SMTP without STARTTLS) are the primary target — flag any in use as High severity findings on an internal assessment
- DNS queries reveal activity even when HTTPS is in use — encrypted DNS (DoH/DoT) is the correct mitigation
- On a switched network, ARP poisoning is required before passive sniffing is useful — detection of ARP anomalies in Wireshark is the fastest indicator
- NTLM hashes captured over SMB can be relayed without cracking using ntlmrelayx — always check for SMB signing disabled on internal assessments