# Anonymous Pingu (Easy) - Dockerlabs

## Anonymous pingu

### Reconocimiento

En primer lugar lanzo un nmap para identificar servicios, ya de primeras llama mucho la atención ese servidor FTP con un directorio que permite escritura y login anónimo.

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

### Explotación

Ni siquiera hace falta visitar la página, basta con subir una revshell de PHP a la página y luego hacer una solicitud a `http://ip-dockerlab/upload/shell.php`. Subo el archivo al servidor FTP con `curl` y no da ningún problema, ahora sé que esta en `/upload`

```
curl -T shell.php ftp://172.17.0.2/upload/
```

Ahora, al visitar `http://172.17.0.2/upload/` me encuentro con esto:

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

Simplemente clico en el archivo y ya estoy dentro como `www-data`

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

### Post explotación

Lo primero al entrar es sanitizar la shell con:

```
export SHELL=bash
export TERM=xterm-256color
source /etc/skel/.bashrc
```

Luego, lanzando un `sudo -l` rápidamente se ve que podemos escalar al usuario `pingu` a través del binario man, sin embargo, después de varios intentos veo que no hay manera, así que pruebo una [sanitización alternativa](https://invertebr4do.github.io/tratamiento-de-tty/#) por si era la shell y ahora si funciona.

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

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

Una vez ya soy pingu, al lanzar `sudo -l` de nuevo veo dos binarios a través de los que escalar al usuario `gladys`, y me quedo con `dpkg`, simplemente con:

```
sudo -u gladys dpkg -l
## Escribir !/bin/bash
```

Ya he escalado al usuario `gladys`

<figure><img src="/files/698h92uw6OVgUNrekac9" alt=""><figcaption></figcaption></figure>

Después de un rato, no supe terminar esta parte, y me serví del [writeup de d1se0](https://dise0.gitbook.io/h4cker_b00k/ctf/dockerlabs/anonymouspingu-dockerlabs-easy#escalate-privileges) para aprender el método y finalizar.


---

# 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/anonymous-pingu-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.
