sshuttle is a “poor man’s VPN” over SSH — it transparently routes traffic to a given subnet through a pivot without touching proxychains or configuring per-tool proxies. No SOCKS, no wrapper commands, just native networking.
Only works when the pivot has SSH and Python installed. SSH-only pivots (routers, embedded appliances) → use regular ssh -D instead.
Install
sudo apt install sshuttleNothing to install on the pivot — sshuttle uploads the Python side over SSH at runtime.
Basic Usage
# Syntax
sudo sshuttle -r user@pivot internal_subnet/mask
# Example
sudo sshuttle -r ubuntu@10.10.10.10 172.16.5.0/24 -vNow any tool on your box that hits 172.16.5.0/24 is silently tunneled through the pivot:
nmap -sT -p445 172.16.5.19 # No proxychains needed
smbclient -L //172.16.5.19
xfreerdp /v:172.16.5.19Flags Worth Knowing
| Flag | Purpose |
|---|---|
-v | Verbose — see every connection as it happens |
-N | Auto-reconnect when the SSH session drops |
--dns | Capture local DNS queries and resolve via the pivot’s DNS (essential for AD) |
-X <net> | Exclude a subnet (prevents locking yourself out of the local LAN) |
-x <host> | Exclude a single host |
-H or --auto-hosts | Scan /etc/hosts on the pivot and resolve those names locally |
The “Ultimate” Pivot Command
sudo sshuttle -r user@10.10.10.50 10.10.11.0/24 --dns -N -v--dns is the one people forget. Without it, xfreerdp /v:dc01.corp.local fails because your box can’t resolve dc01.corp.local — sshuttle only intercepts IP traffic. With --dns, lookups go through the pivot’s resolver.
Multiple Subnets
sudo sshuttle -r user@pivot 10.10.11.0/24 10.10.12.0/24 172.16.0.0/16Why Pick Sshuttle Over ssh -D
- No per-tool
proxychainsprefix - Works for tools that don’t speak SOCKS (ping, some custom clients)
- Transparent to scripts — they just work
- DNS routing is built-in
Why Not
- Needs Python on the pivot
- Needs root on your box (to install transparent iptables/pf rules)
- Not usable from a non-Linux attack host
- Noisier on the pivot — writes Python to
/tmp
For Windows pivots or clean footprint → stick with ssh -D or Chisel.
Cleanup
Hitting Ctrl+C on the sshuttle process reverts iptables and ends the tunnel. If it crashes mid-run, check your firewall rules:
sudo iptables -t nat -L OUTPUT -n # look for sshuttle chainssshuttle also installs a signal handler that cleans up on SIGTERM, so a clean kill works.
