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

# Divulgation d'informations SSTI via des objets utilisateur Python

### Injection de modèles côté serveur avec divulgation d'informations via des objets fournis par l'utilisateur

L'objectif du laboratoire est d'utiliser une SSTI causée par la manière dont un objet est transmis au modèle pour récupérer des données sensibles, notamment la clé secrète du framework. / Nous avons un compte : `content-manager: C0nt3ntM4n4g3r`.

#### Analyse et identification de l'ITST

La première étape consiste à provoquer une erreur dans le moteur de modèles avec l'expression suivante :

```
{{}}
```

<figure><img src="/files/3507afa8ed1edf1541d07f1f227a9e4804c82b88" alt=""><figcaption></figcaption></figure>

* Cela confirme que nous pouvons injecter du code de modèle côté serveur.

Essayez ensuite d'afficher davantage d'informations de débogage en injectant :/ `{% debug %}`

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

* Cependant, aucune information intéressante ou sensible n'apparaît dans la sortie.

<figure><img src="/files/528fa44140f14519820c2cfcdc01fd469a3335e0" alt=""><figcaption></figcaption></figure>

#### Récupération de la clé secrète

* Comme l'objet transmis au modèle donne accès à la configuration, on essaie de lire directement la clé secrète du framework via les paramètres : / `{{settings.SECRET_KEY}}`

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

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

* Cette expression révèle la **clé secrète** utilisée par le framework.

Cette valeur est ensuite soumise au laboratoire pour validation.


---

# 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/fr/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.
