0x01 前言
0x02 ICMP流量结构
-
ICMP协议在实际传输中数据包:20字节IP首部 + 8字节ICMP首部 + 1472字节<数据大小> -
ICMP报文格式:IP首部(20字节) + 8位类型 + 8位代码 + 16校验和 + (不同类型和代码,格式也有所不同) -
ping和ICMP的关系:ping命令发送数据使用的是ICMP协议 -
ICMP协议通过IP协议发送的,IP协议是一种无连接的,不可靠的数据包协议 -
向指定的网络地址发送一定长度的数据包,按照约定,若指定网络地址存在的话,会返回同样大小的数据包 -
除了ping还有Traceroute也使用了icmp协议,另外一些设备也会通过该协议去判断某些错误
0x03 ICMP隧道优缺点
0x04 ICMP隧道
4.1 icmpsh
4.2 icmp隧道
-
突破专门认证:连接到公共场所,如酒店、机场等wifi,可以突破其页面认证 -
突破防火墙:绕过防火墙的一些防护策略 -
加密通信:可以通过加密,创建完全加密的通信通道 -
突破运营商的TCP或者UDP速度限制
4.2.1 icmptunnel
-
数据加密- ICMP有效载荷是加密的。 -
多功能性-任何IP流量都可以通过隧道。
下载
git clone https://github.com/DhavalKapil/icmptunnel编译 cd icmptunnel make在服务端(攻击机)起服务(需要root权限) ./icmptunnel -s 10.0.1.1
roule -n //查看网关地址
./icmptunnel -c server-ip
ssh -D 8080 -N [email protected]
cd icmptunnel
make
ifconfig tun0 10.0.2.1 netmask 255.255.255.0
./icmptunnel <server>
ifconfig tun0 10.0.2.2 netmask 255.255.255.0
4.2.2 pingtunnel
-
连接可靠 -
支持多连接 -
支持加密
sudo wget (最新release的下载链接)
sudo unzip pingtunnel_linux64.zip
sudo ./pingtunnel -type server
4.2.3 ptunnel-ng
git clone https://github.com/lnslbrty/ptunnel-ng.git
cd ptunnel-ng/
执行./autogen.sh
如果报错说命令没找到,需要安装autoconf automake libtool依赖库
make install
Proxy(Server):
./ptunnel-ng -r<destination address> -R<destination port> -v <loglevel>
-P<password> -u<user> -g<group>
Forwarder(Client):
./ptunnel-ng -p <address> -l <listen port> -r<destination address>
-R<destination port> -v <loglevel>
-P<password> -u<user> -g<group>
在server端执行
ptunnel-ng
在client端执行
ptunnel-ng -p[Server-IP/NAME] -l2222
0x05 流量检测
windows系统下ping默认传输的是:abcdefghijklmnopqrstuvwabcdefghi,共32bytes
linux系统下,ping默认传输的是48bytes,前8bytes随时间变化,后面的固定不变,内容为!”#$%&’()+,-./01234567
0x06 总结
0x07 参考文章
本文始发于微信公众号(雷石安全实验室):内网渗透-隧道与转发之ICMP
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论