> For the complete documentation index, see [llms.txt](https://propus.gitbook.io/hackbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://propus.gitbook.io/hackbook/writeups/dockerlabs/whereismywebshell.md).

# 🟩 WhereIsMyWebShell

## 🕵️ Reconocimiento

Comenzamos con un escaneo de puertos con `nmap`:

```bash
nmap -sC -sV -Pn $IPTARGET | tee nmap
```

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

Solo se encuentra el puerto del servicio web activo. Procedemos a realizar un escaneo de directorios:

{% code overflow="wrap" %}

```bash
ffuf -w /usr/share/wordlists/SecLists-2025.2/Discovery/Web-Content/directory-list-2.3-medium.txt:FUZZ -u "http://$IPTARGET/FUZZ" -e .html,.php,.txt,.xml,.js
```

{% endcode %}

<figure><img src="/files/0jFfb6qkDdjf2505Jc3N" alt=""><figcaption></figcaption></figure>

Si entramos a la página `warning.html`, encontramos el siguiente mensaje:

<figure><img src="/files/9hRzafMe9PfuB88mIjib" alt=""><figcaption></figcaption></figure>

Tendremos que realizar un escaneo de parámetros en `shell.php` para ver qué parametro es el utilizado para la webshell.

{% code overflow="wrap" %}

```bash
ffuf -w /usr/share/wordlists/SecLists-2025.2/Discovery/Web-Content/burp-parameter-names.txt:FUZZ -u "http://$IPTARGET/shell.php?FUZZ=whoami" -mc 200
```

{% endcode %}

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

Vemos que el parámetro es `parameter`. Con esto podemos ejecutar comandos en la máquina víctima.

## 🚪 Ganando acceso

Con burpsuite capturamos la petición e inyectamos el comando que nos ejecuta la reverse shell. En este caso he usado PHP con la herramienta [reverse shell generator](https://www.revshells.com/).

<figure><img src="/files/5qrbglFZrNlBk9oOGFo5" alt=""><figcaption></figcaption></figure>

Nos ponemos a la escucha con `netcat` y mandamos la petición.

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

## 💥 Escalada de privilegios

Buscamos los ficheros .txt en el sistema. Encontramos un fichero en `/tmp/.secret.txt`:

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

Este fichero contiene la contraseña de `root`, por lo que nos da acceso directo.

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