Man-in-the-Middle
A Man-in-the-Middle (MITM) attack places the attacker between two parties who believe they are communicating directly, letting the attacker read, modify or inject traffic. It is not a single technique but a pattern: it is achieved through many paths (ARP spoofing, DNS spoofing, rogue DHCP, mitm6, rogue AP, WPAD). Once in the middle, the attacker harvests credentials, steals sessions, downgrades encryption and redirects the victim to controlled infrastructure.
Threat model
Section titled “Threat model”MITM exploits the fact that victims trust the network path. If the attacker gets the traffic to flow through them —by poisoning ARP, spoofing DNS, posing as the gateway or the DHCP server— they can act on communications that were meant to be private. Well-implemented end-to-end encryption (TLS with certificate validation, HSTS) is the defence that reduces a MITM to “metadata only”: the attacker sees who you talk to, but not what you say.
flowchart TD
subgraph vias["Ways to get in the middle"]
ARP[ARP spoofing - L2]
DNS[DNS spoofing]
DHCP[Rogue DHCP]
M6[mitm6 - IPv6]
LL[LLMNR/NBT-NS]
AP[Rogue AP / Evil Twin]
end
vias --> MITM["Attacker in the middle"]
MITM --> S[Credential sniffing]
MITM --> SS[SSL stripping]
MITM --> RD[Redirection / phishing]
MITM --> RL[NTLM capture and relay]
Red Team — ways to get in the middle
Section titled “Red Team — ways to get in the middle”Each path fits a different scenario:
- ARP spoofing — layer 2, same segment; the most common on wired LANs (ARP Spoofing).
- DNS spoofing — answer DNS queries with fake IPs (DNS Attacks).
- Rogue DHCP — a fake DHCP server that hands out an attacker-controlled gateway and DNS.
- mitm6 — DHCPv6/IPv6 DNS; IPv6 is often enabled and unmonitored (IPv6 Attacks).
- LLMNR/NBT-NS — answer name resolutions on Windows networks (see LLMNR / NBT-NS / mDNS Poisoning).
- Rogue AP / Evil Twin — a fake WiFi access point impersonating a legitimate one.
- WPAD — advertise a malicious automatic proxy.
What to do once in the middle
Section titled “What to do once in the middle”# intercept and capture on a LAN: bettercap only opens the console; you must activate modulesbettercap -iface eth0 -eval "set arp.spoof.targets 10.0.0.5; arp.spoof on; net.sniff on"
# capture and relay Windows authentication (most profitable in AD).# For RELAYING, disable HTTP and SMB in Responder.conf (= Off): they compete with ntlmrelayx for 80/445.responder -I eth0 -wd # capture/poisoning (SMB/HTTP OFF if you will relay)ntlmrelayx.py -tf targets.txt -smb2supportTypical actions against the intercepted victim:
- Sniffing of cleartext credentials, cookies and tokens (Network Sniffing).
- SSL stripping: force HTTP where HSTS does not prevent it.
- DNS spoofing: the victim requests
bank.comand gets the attacker’s IP (phishing). - Capture/relay of Net-NTLMv2 hashes to other services.
The Windows case: Responder + relay
Section titled “The Windows case: Responder + relay”On corporate networks, the most profitable MITM is not ARP but spoofing name resolution (LLMNR/NBT-NS/mDNS) and mitm6 (IPv6). You capture Net-NTLMv2 hashes or relay them to other services to gain direct access (see LLMNR / NBT-NS / mDNS Poisoning, NTLM Relay). It is the most reliable initial-access chain in Active Directory.
SSL stripping and its limits
Section titled “SSL stripping and its limits”SSL stripping downgrades HTTPS to HTTP by intercepting the first cleartext request before the redirect to HTTPS. HSTS stops it (the browser demands HTTPS for that domain for the period set by max-age), and HSTS preload prevents it entirely (the browser already ships the domain in its list). Against well-configured sites, the MITM sees an encrypted connection but not its content.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Symptoms of the underlying techniques: ARP changes (ARP Spoofing), unexpected DNS replies, unauthorized DHCP servers, anomalous DHCPv6 traffic (mitm6), unexpected WPAD.
- Certificate alerts on clients (intercepted TLS with an invalid certificate).
- LLMNR/NBT-NS resolutions answered by non-legitimate hosts.
Hardening
Section titled “Hardening”- Strong end-to-end encryption: HTTPS + HSTS (preload), SSH, VPN; always validate certificates.
- Layer 2/3: DAI, DHCP snooping, port security, 802.1X; RA Guard / DHCPv6 Guard against mitm6.
- Disable LLMNR/NBT-NS/WPAD and IPv6 if unused (cuts Responder and mitm6 — see LLMNR / NBT-NS / mDNS Poisoning).
- Enforce SMB and LDAP signing plus channel binding (breaks the relay — see NTLM Relay).
- Segmentation and continuous network monitoring.
Response
Section titled “Response”Identify and isolate the attacking host, revert the poisoning (ARP/DNS/DHCP), rotate any credentials that may have been captured and deploy the missing layer 2/3 and signing controls.
CVEs and real-world cases
Section titled “CVEs and real-world cases”MITM is a technique category, not a CVE: MITRE ATT&CK captures it under T1557 (covering ARP, LLMNR/NBT-NS and DHCP spoofing). The mitm6 + ntlmrelayx chain (documented by Dirk-jan Mollema) is a standard for compromising AD over IPv6. The SSL stripping described by Moxie Marlinspike in 2009 drove the mass adoption of HSTS. Open WiFi and poorly segmented corporate networks remain a common setting for real-world MITM.
Checklist
Section titled “Checklist”- Choose the MITM path for the environment (ARP/DNS/DHCP/mitm6/LLMNR)
- Get in the middle without cutting the connection (forwarding)
- Capture traffic and credentials (sniffing)
- Try SSL stripping and check whether HSTS prevents it
- DNS spoofing to redirect to a controlled host
- Windows: Responder + relay for hashes/access
- Blue: verify E2E encryption, signing and L2/L3 controls
- Document what stayed protected by encryption