For the complete documentation index, see llms.txt. This page is also available as Markdown.

MSF Tunneling

Configuring MSF SOCKS Proxy

use auxiliary/server/socks_proxy
set SRVPORT 9050
set version 4a
run

Confirm Proxy Server is Running

jobs
  • Add line to /etc/proxychains.conf if needed - for tools external to MSF to use this proxy

socks4 	127.0.0.1 9050

Instruct socks_proxy Module to Route All Traffic via Meterpreter Session

use post/multi/manage/autoroute
set SESSION 2
set SUBNET 192.168.1.0 # IF MANUAL ENTRY DESIRED OTHERWISE IT WILL AUTO SELECT BASED ON HOST ROUTING TABLE
run

Alternatively Add Routes from Meterpreter Session

run autoroute -s 172.16.5.0/23

List Active Routes

run autoroute -p

Setup Auto Route

Set Up Proxy

  • Verify proxychains conf


Routes

List Routes

Add Route

Delete Route

Meterpreter Tunneling & Port Forwarding

Meterpreter Tunneling and Port Forwarding

Get Meterpreter Session on Pivot Host

Start msfconsole Listener

Execute Payload on Pivot Host

Ping Sweep from Meterpreter Session


Local Port Forward

Port Forwarding - Executed from Meterpreter Session

Local TCP Relay

  • -l 3300 - Listener on attack machine to forward 3300 to 3389 on -r IP

Connect via RDP

Evil-WinRM


Remote Port Forward

Reverse Port Forwarding - Executed from Meterpreter Session

  • 1234 listener on pivot host will forward to 10.10.14.148:8081

Background Session and Start multi/handler

Generate Payload

  • Transfer and execute payload on Windows host to get Meterpreter session


Payload Generation for Pivoting

Windows Reverse HTTPS (through SSH reverse port forward)

Windows Bind TCP (for socat bind shell relay)


Handler Configurations

Reverse HTTPS (for SSH reverse port forward)

Bind TCP (for socat bind shell relay)


Pivot File Transfer Chain

SCP payload to pivot host:

Start HTTP server on pivot:

Download on Windows target:


rdp_scanner Auxiliary Module


Ping Sweep One-Liners

Linux bash:

Windows CMD:

Windows PowerShell:

Last updated