Windows port forwarding
1. Port forwarding via SSH
SSH can be used to perform tunneling. Nowadays Windows is distrubuted with the OpenSSH client included by default.
1.1. Remote port forwarding
Now the ip3:port3
is available from ip1 on user1@localhost:port1
. Port numbers don't need to match. Local port localhost:9999
can be forwarded to the remote RDP 1.1.1.1:3389
service.
1.2. Local port forwarding
Now the ip1:port1
is available from ip3
via ip2:port2
. In other words, ip2:port2
points to ip1:port1
.
2. Port forwarding with Socat
Socat allows to forward ports in a simpler way than SSH but it have to be transfered to the pivot host.
Socat performs some kind of a reversed local port forwarding. It opens local (IP2 pivot) port. It's easier than connecting to the IP1 directly but it might require to create a firewall rule to allow any connections to the opened port.
Now the ip3:port3
is available via ip2:port2
. To open the pivot's port:
3. Chisel tool
Chisel is a swiss-knife tool (Linux and Windows) for any kind of a port forwarding.
3.1. Reverse port-forwarding
It makes connection from the server to the attacker host.
3.2. Reverse port-forwarding using SOCKS proxy
It is useful if we want to access many ports on the victim's machine.
Now you can use proxychains
before every command to tunnel the requests to the victim's server. There is also configuration in the Burp Suite
for that purpose.