天天看點

端口轉發小結

作者:ailx10
端口轉發小結

端口轉發,也有人叫端口反彈,簡單的很,總結了10個端口轉發小技巧,其實就是A能通路B,B能通路C,但是A不能通路C,端口轉發就是讓A能通路C,舉個不恰當的例子:

情景:小黑能夠通路和控制跳闆機,跳闆機能通路手機

考驗:請幫小黑直接通路手機

我們發現,除了SSH本地轉發在本地操作,其他9個端口轉發都是在跳闆機上操作,是以請記住,端口轉發通常都是發生在跳闆機上,從安全事件的角度來看,跳闆機就是失陷主機,需要重點排查~

端口轉發小結
端口轉發小結

ailx10

網絡安全優秀回答者

網絡安全碩士

去咨詢

  • ailx10:SSH本地端口轉發
1、在本地操作
2、ssh -CfNg -L <本地端口>:<受害者IP>:<受害者端口> <跳闆機SSH>
3、通路本地端口           
  • ailx10:SSH遠端端口轉發
1、在跳闆機操作
2、ssh -CfNg -R <跳闆機端口>:<受害者IP>:<受害者端口> <本地SSH>
3、通路跳闆機端口           
  • ailx10:端口轉發工具 rinetd
1、在跳闆機操作
2、0.0.0.0 <跳闆機端口> <受害者IP> <受害者端口>
3、rinetd -c /etc/rinetd.conf
4、通路跳闆機端口           
  • ailx10:iptables 端口轉發
1、在跳闆機操作
2、iptables -t nat -A PREROUTING -p tcp --dport <跳闆機端口> -j DNAT --to-destination <受害者IP>:<受害者端口>
3、iptables -t nat -A POSTROUTING -p tcp -d <受害者IP>> --dport <受害者端口> -j SNAT --to-source <跳闆機IP>
4、通路跳闆機端口           
  • ailx10:firewall 端口轉發
1、在跳闆機操作
2、firewall-cmd --permanent --add-forward-port=port=<跳闆機端口>:proto=tcp:toaddr=<受害者IP>:toport=<受害者端口>
3、firewall-cmd --reload
4、通路跳闆機端口           
  • ailx10:ufw 端口轉發
1、在跳闆機操作
2、-A PREROUTING -p tcp --dport <跳闆機端口> -j DNAT --to-destination <受害者IP>:<受害者端口>
3、-A POSTROUTING -p tcp -d <受害者IP> --dport <受害者端口> -j SNAT --to-source <跳闆機IP>
4、通路跳闆機端口           
  • ailx10:nc 端口轉發
1、在跳闆機操作
2、nc -lp <跳闆機端口> -c "nc <受害者IP> <受害者端口>"
3、通路跳闆機端口           
  • ailx10:socat 端口轉發
1、在跳闆機操作
2、socat TCP-LISTEN:<跳闆機端口>,reuseaddr,fork TCP:<受害者IP>:<受害者端口>
3、通路跳闆機端口           
  • ailx10:portmap 端口轉發
1、在跳闆機操作
2、./portmap -m 1 -p1 <跳闆機端口> -h2 <受害者IP> -p2 <受害者端口>
3、通路跳闆機端口           
  • ailx10:NATBypass 端口轉發
1、在跳闆機操作
2、./nb -tran <跳闆機端口> <受害者IP>:<受害者端口>
3、通路跳闆機端口           

網絡安全任重道遠,洗洗睡吧~

端口轉發小結

釋出于 2022-07-24 18:13