Once you hold a host that sits on two networks, the next question is how to reach the second one from your own machine. A SOCKS proxy through it works, but only for tools that speak SOCKS, and the common ones carry only TCP. This article compares sshuttle, Metasploit’s routing table, Ligolo-ng and chisel, then covers how defenders spot them. Test only networks and systems you own or are authorised to assess.
When a SOCKS proxy is not enough
An SSH dynamic forward, covered in SSH forwarding and proxychains, works only for SOCKS-aware tools or ones wrapped by proxychains, and OpenSSH’s SOCKS server accepts only TCP CONNECT requests. Metasploit’s pivoting guide notes that ICMP and UDP cannot tunnel through its SOCKS proxy, so ping sweeps and UDP scans fail. A routed pivot is simpler: you add a route, and ordinary tools use ordinary addresses.
MITRE tracks this as T1572 Protocol Tunneling and T1090 Proxy, with T1090.001 for an internal proxy.
sshuttle: a transparent proxy over SSH
sshuttle assembles each TCP stream locally and multiplexes it over one SSH session, so it avoids TCP over TCP. The client needs root, but sshuttle runs sudo itself for its firewall manager, so start it as your normal user. The server needs no admin access, only Python (3.10 or newer at v2.0.0).
The --method option defaults to auto, which tries nat, nft, pf and ipfw in turn, by what is in PATH. On Linux the nat method needs iptables and the nft method needs nftables, and both carry TCP and DNS. UDP needs --method tproxy, which auto never picks and which must run as root. -r names the SSH server and subnets follow. --dns sends local DNS queries to the remote side. -N asks the server for subnets from its routing table, and does not detect IPv6 routes. -x excludes a subnet, so 0/0 -x forwards everything except the networks you name.
Metasploit routes and the SOCKS module
Metasploit routes traffic inside the framework: a route maps a subnet to a session, and any module connecting to that subnet goes through it. The guide says this works for Meterpreter and SSH sessions over TCP channels.
You can add a route by hand with route add 10.20.0.0/24 1, where 1 is the session ID, or use the post/multi/manage/autoroute module, which needs Meterpreter. Its CMD defaults to autoadd, which reads subnets from the pivot’s routing table and interface list; for a SUBNET of your choosing, set CMD to add. Give NETMASK in dotted form: it became an address option in March 2026, and the guide’s /16 example predates that.
Routes serve only Metasploit modules. For other tools, auxiliary/server/socks_proxy starts a SOCKS server on the framework’s routing table. Its options are SRVHOST, SRVPORT (default 1080), VERSION (5 by default, or 4a) and, for SOCKS5, optional USERNAME and PASSWORD. Set SRVHOST to 127.0.0.1, as the guide does; the default 0.0.0.0 listens everywhere. External tools then run through proxychains, within the SOCKS limits above. Metasploit and msfvenom in a Lab builds one target.
Ligolo-ng: a tun interface instead of a proxy
Ligolo-ng, written by Nicolas Chatelain (nicocha30), runs a proxy on your machine and an agent on the pivot. The agent connects out to the proxy over TLS with -connect, or listens with -bind, and the proxy creates a tun interface. A userland network stack translates packets sent to that interface into ordinary connections from the agent. It carries TCP, UDP and ICMP echo, and the agent needs no administrative access.
The agent cannot send raw packets, so a SYN scan becomes a connect(). The README recommends --unprivileged or -PE with Nmap to avoid false positives.
The syntax changed at v0.6: older guides use ip tuntap add, and the documentation still names interface_add and an agent --socks option, neither defined at v0.9.2. At v0.9.2 the console has interface_create and route_add, and the agent reaches the proxy through an upstream proxy with -proxy and a URL. Check -h on your copy.
Chisel in one paragraph
Chisel, by Jaime Pillora (jpillora), carries TCP and UDP over HTTP, secured with SSH, in a single executable that acts as client or server. A server started with --reverse lets the client expose a SOCKS5 proxy on the server’s 127.0.0.1:1080 with R:socks. The README recommends --fingerprint on the client, and the server shows its fingerprint when it starts.
Comparing the four
| sshuttle | Metasploit route and SOCKS | Ligolo-ng | chisel | |
|---|---|---|---|---|
| Root needed | Client side, not the server | Not stated | Proxy host (tun interface), not the agent | Not stated |
| Carried | TCP and DNS; UDP with tproxy | TCP through the SOCKS module | TCP, UDP, ICMP echo | TCP and UDP over HTTP |
| ICMP | No, rules capture TCP and UDP | Not through SOCKS | Echo requests | No, remotes are TCP or UDP |
| Footprint | SSH plus Python on the pivot | A Meterpreter or SSH session | One agent binary, outbound TLS | One binary, HTTP WebSocket |
Lab topology and commands
The lab: your VM at 192.0.2.10, a pivot VM at 192.0.2.20 that also holds 10.20.0.20, and a target at 10.20.0.30 reachable only from the pivot, all on host-only networks you own.
Checked against sshuttle v2.0.0, Metasploit Framework 6.5.13, Ligolo-ng v0.9.2 and chisel v1.12.0 (its latest release; v1.13.0 is a prerelease).
# as your normal user: sshuttle asks for sudo itself
sshuttle -r [email protected] 10.20.0.0/24 --dns
sshuttle -r [email protected] -N
sshuttle -r [email protected] 0/0 -x 192.0.2.0/24
msf > route add 10.20.0.0/24 1
# or, with a Meterpreter session, the module:
msf > use post/multi/manage/autoroute
msf post(multi/manage/autoroute) > set SESSION 1
msf post(multi/manage/autoroute) > set CMD add
msf post(multi/manage/autoroute) > set SUBNET 10.20.0.0
msf post(multi/manage/autoroute) > set NETMASK 255.255.255.0
msf post(multi/manage/autoroute) > run
msf > use auxiliary/server/socks_proxy
msf auxiliary(server/socks_proxy) > set SRVHOST 127.0.0.1
msf auxiliary(server/socks_proxy) > set VERSION 5
msf auxiliary(server/socks_proxy) > run
# on your VM (192.0.2.10)
sudo ./proxy -selfcert -laddr 0.0.0.0:11601
ligolo-ng » certificate_fingerprint
# on the pivot (192.0.2.20)
./agent -connect 192.0.2.10:11601 -accept-fingerprint <fingerprint>
# back in the proxy console
ligolo-ng » session
ligolo-ng » interface_create --name lab0
ligolo-ng » route_add --name lab0 --route 10.20.0.0/24
ligolo-ng » tunnel_start --tun lab0
# from your VM
nmap --unprivileged -n -Pn -p 445 10.20.0.30
# on your VM (192.0.2.10)
./chisel server --reverse --port 8080
# on the pivot (192.0.2.20)
./chisel client --fingerprint <fingerprint> 192.0.2.10:8080 R:socks-accept-fingerprintpins the proxy’s self-signed certificate, whichcertificate_fingerprintprints, so run that first.- For sshuttle,
-vshows which firewall method was chosen and whether UDP is on.
Detection and defence
Egress filtering is the first control. In the setups above the Ligolo-ng agent and the chisel client connect outward, so allow-listing outbound destinations removes the channel; an agent started with -bind listens instead, which inbound filtering on the pivot stops. MITRE lists network allow and block lists (M1037) and signature based network intrusion prevention (M1031) as mitigations for T1090, and warns that signatures differ between tools and versions.
On the network, MITRE’s T1572 detection strategy (DET0538) points to encapsulated protocols, port and protocol mismatches, large asymmetric flows and unusual volume. Ligolo-ng’s proxy listens on port 11601 by default and chisel’s server on 8080. The chisel client opens a WebSocket with the header Sec-WebSocket-Protocol: chisel-v3, visible wherever the HTTP is unencrypted. Ligolo-ng’s proxy itself warns that its default self-signed certificate name, ligolo, is a known indicator, but TLS 1.3, Go’s default, encrypts the certificate, so check for it by probing a suspect listener. After a lost connection its agent reconnects by default, every 20 seconds for up to five minutes.
MITRE scopes TLS inspection (M1020) for T1090 to domain fronting, but where you decrypt TLS, chisel’s header and Ligolo-ng’s certificate show again.
On hosts, MITRE’s T1090 strategy (DET0445) lists suspicious process spawning followed by connections to internal hosts or uncommon ports, and tools such as ssh used in non-standard ways.
Segmentation limits the damage. Metasploit’s guide says a pivot needs a host connected to two or more networks, so remove dual-homed servers and restrict which hosts may initiate connections into server subnets.
The Command and Control Fundamentals for Red Teams course covers command and control channels and how defenders catch them in network logs and signatures.
Where to go next
The Command and Control Fundamentals for Red Teams course is the next step, from channel types and beaconing through to detection engineering. For the full workflow from first scan to report, see Penetration Testing Field Notes.
This article replaces the KSEC ARK notes first published in 2019.
More from this author
- One capture, three questions2 December, 2026
- Payload channels versus timing channels2 December, 2026
