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

# Divulgação de Informações por SSTI via Objetos de Usuário Python

### Injeção de Template do Lado do Servidor com Divulgação de Informações via Objetos Fornecidos pelo Usuário

O objetivo do laboratório é usar uma SSTI causada pela forma como um objeto foi passado ao template para recuperar dados sensíveis, especialmente a chave secreta do framework. / Temos uma conta: `content-manager: C0nt3ntM4n4g3r`.

#### Análise e Identificação de ITST

O primeiro passo é causar um erro no mecanismo de templates com a seguinte expressão:

```
{{}}
```

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

* Isso confirma que podemos injetar código de template do lado do servidor.

Em seguida, tente exibir mais informações de depuração injetando:/ `{% debug %}`

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

* No entanto, nenhuma informação interessante ou sensível aparece na saída.

<figure><img src="/files/1e3b90567d345ff53deb66c8fc69bdca5a1becf7" alt=""><figcaption></figcaption></figure>

#### Recuperação da Chave Secreta

* Como o objeto passado ao template dá acesso à configuração, tenta-se ler diretamente a chave secreta do framework por meio dos parâmetros: / `{{settings.SECRET_KEY}}`

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

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

* Essa expressão revela a **chave secreta** usada pelo framework.

Esse valor é então enviado ao laboratório para validação.


---

# 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/pt-br/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.
