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

# SameSite-Lax-Bypass via Method Override

### SameSite-Lax-Bypass über Method Override

Die Funktion zur Änderung der E-Mail-Adresse des Labs ist anfällig für einen CSRF-Angriff. Die Website verwendet SameSite=Lax, aber es ist möglich, diesen Schutz zu umgehen, indem die POST-Methode über einen d-override-Parameter erzwungen wird (`&_method=POST`) in der URL.

\*\* Ziel\*\*/ Einen Exploit auf dem Exploit-Server hosten (ausgenutzt), der eine Anfrage zum Ändern der E-Mail-Adresse in den Namen des Opfers ausführt, um das Lab zu lösen.

**Zugangsdaten (Testkonto)**/ `wiener: peter`

<figure><img src="/files/1b4f92e9d5a1e003e19c3f56805ce74b07991bc3" alt=""><figcaption></figcaption></figure>

* Eine GET-Anfrage an den Endpunkt zum Ändern der E-Mail-Adresse gibt zurück, dass die Methode nicht erlaubt ist.
* Das Hinzufügen des `&_method=POST` Parameters in der URL führt dazu, dass die Anfrage akzeptiert wird (die Website akzeptiert die Überschreibung und behandelt die Anfrage als POST), wodurch die Aktion trotz SameSite=Lax ausgeführt werden kann.

```
&_method=POST
```

<figure><img src="/files/9e4a1932ba56202f44ffbf101878b9075fcc7876" alt=""><figcaption></figcaption></figure>

#### **Exploit-Server-Payload**

Das folgende Skript leitet das Opfer zur Änderungs-URL der E-Mail weiter, indem es den Override-Parameter einfügt, um einen POST zu erzwingen:

```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/de/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.
