You've compromised a machine, but the juicy targets are on internal networks you can't reach directly. Pivoting (also called "tunneling" or "lateral movement") lets you use compromised hosts as stepping stones to reach otherwise inaccessible systems.
Think of it like this: you've broken into the lobby of a building. The vault is in the basement, accessible only from inside. Pivoting lets you use that lobby computer to access the basement network.
Why Pivot?
Pivoting Concepts
- Pivot Host: The compromised machine you route through
- Local Port Forward: Access remote services via local port
- Remote Port Forward: Expose your services on remote host
- Dynamic Port Forward: SOCKS proxy for all traffic
- Double Pivot: Chain through multiple hosts
SSH Tunneling
SSH
Local Port Forwarding
"Bring remote port to me" - Access internal services locally.
Dynamic Port Forwarding (SOCKS)
Create a SOCKS proxy for flexible routing.
Remote Port Forwarding
"Send my port there" - Expose your services through pivot.
SSH Config for Persistence
Host pivot
HostName 192.168.1.10
User admin
DynamicForward 1080
LocalForward 8080 10.0.0.5:80
Proxychains
Proxychains forces any TCP connection through your proxy. Essential for using tools that don't have native proxy support.
Proxychains Limitations
Chisel
Chisel is a fast TCP tunnel over HTTP. Perfect when SSH isn't available but HTTP traffic is allowed.
Metasploit Pivoting
Meterpreter Port Forward
sshuttle
sshuttle creates a VPN-like connection over SSH. Easier than setting up tunnels for each port.
sshuttle is Magic
Double Pivoting
Sometimes you need to go through multiple hosts to reach your target. Chain proxies to extend your reach.
Windows Pivoting
Pivoting Methodology
Pivoting Process
Knowledge Check
Challenges
Key Takeaways
- Pivoting routes traffic through compromised hosts to reach internal networks
- SSH dynamic forwarding (-D) creates a versatile SOCKS proxy
- Proxychains forces TCP connections through your proxy
- sshuttle creates VPN-like routing over SSH
- Chisel works over HTTP when SSH isn't available
- Metasploit's autoroute enables routing through Meterpreter sessions
- Double pivoting chains tunnels to reach deeply nested networks