# Campana feliz

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2FfuMSnDVmhWU9BtcWflpD%2Fimage.png?alt=media&#x26;token=fa753379-cfaa-4755-a25e-78c93dd582f1" alt=""><figcaption></figcaption></figure>

## Fase de reconocimiento

Primero hacemos un escaneo de nmap para ver los puertos abiertos, y los puertos abiertos son:

* 22 SSH
* 8088 HTTP
* 10000 HTTPS

```bash
nmap -p- -sSVC --min-rate 5000 192.168.8.112 -oG allPorts -vvv
```

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2FP8lAYCCBxGfUMqPJZpKz%2Fimage.png?alt=media&#x26;token=b57a3354-09f7-43ab-9a1f-9ae455ec6bb0" alt=""><figcaption></figcaption></figure>

## Fase de intrusión

En el puerto 8088, no hay un web aparentemente, así que vamos a enumerar los directorios con gobuster, por otra parte en el 10000 hay un webmin pero por ahora voy a hacer fuzzing al 8088:

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2FXhJ7k7G1mAD8DmZY91gu%2Fimage.png?alt=media&#x26;token=ef6583e1-898c-41fc-85d9-c8ce34a21005" alt=""><figcaption></figcaption></figure>

Dentro de "/shell.php" podemos encontrar un login, y dentro del puerto 8088 hay en el código fuente de la página unos caracteres codificados en base64 (Página web que he usado para decodificarlos [Cyberchef](https://gchq.github.io/CyberChef/)):

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2FfcgjdkedMZfUxLwEngKA%2Fimage.png?alt=media&#x26;token=d9d5c774-d5e1-457e-903f-f2cb62147ff2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2Fuf8evbb9tCKMGlrwZuZ7%2Fimage.png?alt=media&#x26;token=6bd6d719-87ee-4fc7-a843-6b4ad17f53bc" alt=""><figcaption></figcaption></figure>

Con relación a el "/shell.php", ahora podríamos realizar un ataque de fuerza bruta con los caracteres decodificados, yo me voy a hacer una lista de usuarios los cuales podrían ser validos y con hydra voy hacer el ataque:

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2F0rxJvwguqLfYpmYtpzqn%2Fimage.png?alt=media&#x26;token=7ea5f2d7-e69e-463c-b86f-ddecdb659f6a" alt=""><figcaption></figcaption></figure>

Iniciamos sesión y nos encontramos con una shell de comandos, así que vamos a mandar una reverseshell a nuestra máquina (Página de [revershells](https://www.revshells.com/)):

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2Ft6rYugTHNgfn4pHkfYwM%2Fimage.png?alt=media&#x26;token=83a90036-20f4-4915-b513-15d572e0a0b7" alt=""><figcaption></figcaption></figure>

## Escalada de privilegios

Con respecto a la shell obtenida, tenemos que hacer una [depuracion-de-tty](https://burple.gitbook.io/burple/cheats/depuracion-de-tty "mention") para poder interactuar sin problemas con ella. Si hacemos un sudo -l podemos ver que todos los usuarios pueden ejecutar la bash sin proporcionar contraseña, así que abrimos la bash como si fueramos root:

<figure><img src="https://2216970731-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgI96Zsgdt6Oh2PlOLDwP%2Fuploads%2F5humVaNO8hqNh4iwoM0O%2Fimage.png?alt=media&#x26;token=ce6e53ae-82fc-4ea4-8876-b162bdf548bb" alt=""><figcaption></figcaption></figure>

## Conclusión

En esta máquina, logramos la intrusión y escalada de privilegios aprovechando varias debilidades:

1. Enumeración de directorios expuestos en el puerto 8088 mediante fuzzing con **Gobuster**.
2. Descubrimiento de credenciales en un mensaje codificado en Base64 dentro del código fuente.
3. Fuerza bruta contra el login de `/shell.php` con **Hydra** para obtener acceso a una shell remota.
4. Escalada de privilegios explotando una configuración insegura en `sudo`, que permitía ejecutar `bash` sin contraseña.


---

# 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://burple.gitbook.io/burple/thehackerslabs/facil/campana-feliz.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.
