Let’s say we have meterpreter shell on Ubuntu PivotHost.
We can create pivot through meterpreter without SSH port forwarding.
We want to interact with Windows machine that is connected to Ubuntu PivotHost
Ping Sweep
Meterpreter
For loop Linux
For loop CMD
PowerShell
Meterpreter Tunneling
Let’s first configure MSF’s SOCKS proxy:
Above configuration starts a listener on port 9050 and routes all the traffic received via our meterpreter session.
We can confirm the proxy server running as such:
Now that we have initiated the SOCKS server, we will configure proxychains to route traffic generated through our pivot on the compromised Ubuntu PivotHost.
Let’s edit /etc/proxychains.conf as such:
We will now set up to route all the traffic via our meterpreter session using post/multi/manage/autoroute:
We can confirm autoroute by checking the route being added to 172.16.5.0/23:
Now we can use proxychains to route our nmap traffic via our Meterpreter session:
Meterpreter Port Forwarding
We can use Metasploit’s portfwd for port forwarding.
We will set up a listener on our attacker host and request meterpreter to forward all the packets received on this port via our meterpreter sessions to a remove host.
Above starts a listener on attacker host’s port 3300 and forward all the packets to the remote Windows server on port 3389.
So we can now execute xfreerdp on attacker host’s port 3300.
Meterpreter Reverse Port Forwarding
We will start a listener on attacker host (port 8081).
Ubuntu PivotHost server will forward all requests received on port 1234 to attacker host’s port 8081.