Course contentsShow
← Security
Lesson 2241 of 3,05243. Offensive Security ToolingFree lesson

Proxychains and SOCKS Tunneling

Route attack traffic through compromised hosts using proxychains, SSH tunnels, and SOCKS proxies for network pivoting.

Proxychains and SOCKS Tunneling

You'll learn how to route attack traffic through compromised hosts using proxychains and SOCKS tunnels to hide your origin and reach otherwise inaccessible network segments.

When you've compromised a machine deep inside a network, you often need to attack additional targets that aren't directly reachable from your attacking machine. This is where proxychains and SOCKS tunneling become essential pivoting tools.

How It Works

Think of it like mailing a package through multiple post offices to hide the true sender. Instead of connecting directly from your Kali machine to a target (which might be impossible or obvious), you route your traffic through one or more compromised hosts acting as relay points.

SOCKS (Socket Secure) is a protocol that creates a tunnel between your machine and a proxy server. You typically establish this using SSH:

ssh -D 1080 user@compromised-host

This creates a SOCKS proxy on your local port 1080, tunneling all traffic through compromised-host.

Proxychains is a tool that forces any application's network connections through your SOCKS proxy chain. Edit /etc/proxychains.conf to specify your proxies:

socks5 127.0.0.1 1080

Then prefix any command to route it through the tunnel:

proxychains nmap -sT 10.10.20.5
proxychains firefox
proxychains impacket-psexec target/user@10.10.20.5

This lets you use tools like Nmap, CrackMapExec, or BloodHound against internal targets as if you were sitting on the compromised network segment, while maintaining operational security by obscuring your true origin.

Key Takeaway: Proxychains combined with SSH-based SOCKS tunnels lets you pivot attack traffic through compromised hosts, reaching deeper network segments while masking your source and bypassing network segmentation.