# BaluFood

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

Como podemos observar durante el escaneo, el **puerto 22** correspondiente al servicio **SSH** y el **puerto 5000**, comúnmente utilizado por **aplicaciones web en desarrollo**, se encuentran abiertos, por lo que a continuación se indagará más sobre ambos servicios, intentando establecer una conexión remota vía SSH y acceder mediante el navegador al servicio web en el puerto 5000 para identificar posibles vectores de ataque.

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p22,5000 -v 172.17.0.2
```

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

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

Revisamos el puerto 5000.

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

### 🚀 **EXPLOTACIÓN**

Es una página web de un restaurante e indagando un poco vemos que tenemos un panel de login y además nos podemos loguear con credenciales por defecto (admin:admin).

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

Viendo el código fuente nos encontramos unas credenciales por lo que nos conectamos por **SSH**.

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

```bash
ssh sysadmin@172.17.0.2
```

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

### 🔐 **PRIVILEGIOS**

Al estar dentro y ejecutar:

```bash
whoami
```

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

```bash
sudo -l
```

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

No tenemos permisos sudo pero en su directorio principal si listamos y mostramos el contenido del archivo **app.py** vemos una contraseña.

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

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

Nos cambiamos al otro usuario con esa contraseña encontrada.

```bash
su balulero
```

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

Revisando el historial nos encontramos que ha cambiado un fichero por lo que revisamos.

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

Hemos encontrado al parecer la contraseña de root por lo que nos logueamos.

```bash
su root
```

<figure><img src="/files/IxnCWuj0OGaDrAkR45lZ" 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/balufood.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.
