> 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/ssti/ssti-information-disclosure-via-python-user-objects.md).

# Divulgación de información SSTI mediante objetos de usuario de Python

### Inyección de plantillas del lado del servidor con divulgación de información mediante objetos proporcionados por el usuario

El objetivo del laboratorio es usar una SSTI causada por la forma en que se ha pasado un objeto a la plantilla para recuperar datos sensibles, especialmente la clave secreta del framework. / Tenemos una cuenta: `content-manager: C0nt3ntM4n4g3r`.

#### Análisis e identificación de ITST

El primer paso es provocar un error en el motor de plantillas con la siguiente expresión:

```
{{}}
```

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

* Esto confirma que podemos inyectar código de plantillas del lado del servidor.

Luego intenta mostrar más información de depuración inyectando:/ `{% debug %}`

```python
{% debug %}
```

* Sin embargo, no aparece información interesante o sensible en la salida.

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

#### Recuperación de la clave secreta

* Como el objeto pasado a la plantilla da acceso a la configuración, se intenta leer directamente la clave secreta del framework mediante los parámetros: / `{{settings.SECRET_KEY}}`

```python
{{settings.SECRET_KEY}}
```

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

* Esta expresión revela la **clave secreta** utilizada por el framework.

Luego se envía este valor al laboratorio para su validación.


---

# 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/ssti/ssti-information-disclosure-via-python-user-objects.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.
