構建內網隱蔽通道,從而突破各種安全策略限制,實現對目標服務器的完美控制。
當我們從外網成功獲得攻擊點的時候,通過反彈shell、端口轉發、內網穿透等技巧,來進一步入侵內網服務器。當我們取得內網目標服務器的控制權限,通過隧道技術繞過網絡限制,實現隱蔽C2
服務器的通信。
在這里,我梳理了一張腦圖,將構建內網隱蔽通道分為突破訪問限制和隱藏通信隧道技術。在不同的場景下進行應用,突破限制訪問內網服務器,利用隧道技術實現C2
通信。
突破訪問限制方式
反彈shell
一句話反彈shell的各種方式 1、系統自帶命令:bash反彈、awk反彈、telnet反彈、socat反彈、powershell反彈、nc反彈等 2、編程語言實現:python反彈、php反彈、perl反彈、ruby反彈、lua反彈等 3、滲透測試框架:MSF、Cobalt strike、Empire、nishang等
端口轉發
端口轉發的幾種常用方法 1、系統自帶命令:ssh端口轉發、iptables端口轉發、firewall端口轉發、rinetd端口轉發、netsh端口轉發、socat端口轉發 2、第三方小工具:lcx端口轉發、ncat端口轉發、portmap端口轉發
內網穿透工具
內網穿透工具,提供http,tcp,udp全隧道穿透 1、ngrok:https://ngrok.com
2、frp:https://github.com/fatedier/frp
3、Sunny-Ngrok:https://www.ngrok.cc
4、Natapp:https://natapp.cn
遠程控制軟件
常見的遠程控制軟件 1、TeamViewer:https://www.teamviewer.cn/cn/
2、向日葵:https://sunlogin.oray.com/
隱藏通信隧道技術
ICMP隧道
將 IP 流量封裝進 IMCP 的 ping 數據包進行傳輸 隧道工具:icmptunnel、ptunnel、icmpsh、powershell icmp等 1、icmptunnel:https://github.com/jamesbarlow/icmptunnel
2、ptunnel:http://www.cs.uit.no/~daniels/PingTunnel/
3、icmpsh:https://github.com/inquisb/icmpsh
4、Powershell-ICMP:https://github.com/api0cradle/Powershell-ICMP
IPv6 隧道
通過 IPv4 隧道傳送 IPv6 數據報文 隧道工具:socat、6tunnel、nt6tunnel等 1、socat:http://www.dest-unreach.org/socat/download/
2、6tunnel:https://github.com/wojtekka/6tunnel
UDP 隧道
將UDP轉TCP發送數據 UDP隧道工具,如Udp2raw-Tunnel、udptunnel等 1、Udp2raw-Tunnel:https://github.com/wangyu-/udp2raw-tunnel
Socks隧道
全能代理,支持多種協議,包括http、ftp請求及其它類型的請求。 socks代理工具: 1、sSocks:http://sourceforge.net/projects/ssocks
2、Earthworm:https://github.com/rootkiter/EarthWorm
3、Shad owsocks:https://shado wsocks.org
socks代理鏈工具: 1、SocksCap64:http://www.sockscap64.com
2、Proxifier:https://www.proxifier.com
3、ProxyChains:http://proxychains.sourceforge.net
HTTP(S) 隧道
把所有要傳送的數據全部封裝到HTTP協議里進行傳送 隧道工具:Kali自帶的HTTPTunnel、reDuh、reGeorg、Tunna等 1、reDuh:https://github.com/sensepost/reDuh
2、reGeorg:https://github.com/sensepost/reGeorg
3、ABPTTS :https://github.com/nccgroup/ABPTTS
4、Tunna:https://github.com/SECFORCE/Tunna
5、node-http-tunnel:https://github.com/johncant/node-http-tunnel
SSH隧道
通過SSH協議構造隧道達成數據加密傳輸 隧道工具:系統自帶的SSH、AutoSSH 1、AutoSSH:https://www.harding.motd.ca/autossh
DNS隧道
通過將其他協議封裝在DNS協議中進行通信。 隧道工具:dnscat2、iodine、dns2tcp等。 1、dnscat2:https://github.com/iagox86/dnscat2
2、iodine:https://github.com/yarrick/iodine
3、dns2tcp:https://pkgs.org/download/dns2tcp