Protocol Tunneling
Wrapping traffic inside another protocol (SSH, HTTP) to reach internal services.
How it shows up on Hack The Box
When ss -tulnp shows services on 127.0.0.1 or there is an internal network, bring the port over with ssh -L or chisel, or set up an interface with ligolo-ng to use your tools without proxychains.
Techniques in our catalog that match this one (the number is their machines):
Machines to practice it
Sorted from easiest to hardest. The ▶ link takes you to the minute of the IppSec video where it is used.
Showing 48 of 56. Open each catalog technique above to see them all.
Guides
- Port forwarding and pivoting: SSH, chisel and socat 3 min read How to reach a service that only listens on 127.0.0.1 or sits on another internal network: local, remote and dynamic SSH tunnels, chisel when there is no SSH, socat and proxychains.
Commands
Taken from our cheatsheets and tool pages. Type your details and they are filled into every command.
Port forwarding and pivoting › SSH
ssh -L 8080:127.0.0.1:8080 [email protected]
Then open http://127.0.0.1:8080 in your browser.
ssh -D 1080 -N [email protected]
ssh -R 8080:127.0.0.1:8080 [email protected] -N
Port forwarding and pivoting › chisel
./chisel server --reverse -p 8000
./chisel client 10.10.14.5:8000 R:8080:127.0.0.1:8080
./chisel client 10.10.14.5:8000 R:socks
Opens a SOCKS5 proxy on port 1080 of your machine.
.\chisel.exe client 10.10.14.5:8000 R:socks
Port forwarding and pivoting › ligolo-ng
sudo ip tuntap add user $(whoami) mode tun ligolo
sudo ip link set ligolo up
session
start
sudo ip route add 172.16.1.0/24 dev ligolo
Replace 172.16.1.0/24 with the internal network; the subnet calculator helps you work it out.
Port forwarding and pivoting › Others
socat TCP-LISTEN:8888,fork TCP:127.0.0.1:80
netsh interface portproxy add v4tov4 listenport=8888 listenaddress=0.0.0.0 connectport=80 connectaddress=172.16.1.10
Chisel › More uses
./chisel client 10.10.14.5:8000 R:3306:127.0.0.1:3306 R:8080:127.0.0.1:8080
Ligolo-ng › Recent versions (0.6 or later)
interface_create --name ligolo
route_add --name ligolo --route 172.16.1.0/24
tunnel_start --tun ligolo
sudo ip route add 240.0.0.1/32 dev ligolo
The special IP 240.0.0.1 points to the agent's localhost.
No command matches.