Skip to main content

Pivoting with the Metasploit Framework

Mastering Metasploit: Pivoting Strategies for Ethical Hackers
Welcome back, fellow ethical hackers! In this tutorial, we're going to delve into the art of pivoting with Metasploit, an essential skill for penetration testers seeking to extend their reach within a compromised network. Buckle up, and let's enhance our post-exploitation game!

Adding a New Route
To expand our network foothold, we often need to add new routes. Metasploit makes this process a breeze:

msf5 > route add 11 [*] Route added

Invoking the autoroute Module
Next, let's leverage the multi/manage/autoroute module to automate route additions. 
This is particularly handy when you want to streamline the process:
use multi/manage/autoroute
set session <SESSION ID>

Setting up a SOCKS Proxy using autoroute
Now, let's enhance our maneuverability with a SOCKS proxy. First, set up the auxiliary server:
use auxiliary/server/socks4a
exploit -j

Add the proxy information to proxychains.conf:
sudo echo "socks4 1080" >> /etc/proxychains.conf

Connect to a target using the proxy:
sudo proxychains rdesktop <TARGET IP>

Forward Port Forwarding on Port 3389
Metasploit allows us to forward ports seamlessly. Let's forward port 3389 as an example:
portfwd add -l 3389 -p 3389 -r <TARGET IP>

meterpreter > portfwd add -l 3389 -p 3389 -r
[*] Local TCP relay created: :3389 <->

Gaining Remote Desktop Access using Port Forwarding
With the port forward in place, access the remote desktop:

There you have it! These Metasploit techniques can be powerful tools in your ethical hacking arsenal. Remember, with great power comes great responsibility. Happy hacking!