> 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/business-logic/failed-state-machine-workaround.md).

# Обход неудачного конечного автомата

Заметки по лабораторным работам PortSwigger Web Security Academy об обходе неудачного конечного автомата, включая рабочий процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст устранения уязвимости.

### Обход аутентификации через ошибочный автомат состояний

Эта лабораторная работа основана на неверных предположениях о последовательности шагов в процессе аутентификации. Используя этот плохо спроектированный автомат состояний, можно обойти аутентификацию, получить доступ к интерфейсу администрирования и удалить пользователя **carlos**.

Предоставленный идентификатор:

* **Пользователь:** wiener
* **Пароль:** peter

**Основное наблюдение**

Процесс входа разделён на несколько последовательных шагов, включая промежуточный этап выбора роли.

Приложение предполагает, что все шаги выполняются по порядку и что каждый запрос был должным образом проверен перед переходом к следующему.

**Этапы выполнения**

1. Соединение с действительными `wiener:peter` учётными данными.
2. После входа приложение предлагает этап **выбора роли**.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2d7422ef8447c6ebbf8d21ad7f08aa9ee0a90df1%2F%7B63EBA66C-DEAF-415F-9D3E-EC96C18DCCD6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Нажмите «Далее», чтобы продолжить.
* Во время GET-запроса к **селектору ролей**, перехватите запрос.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-743746c175c66d95624c00ea6b0ed5c1f30dec72%2F%7B62FB8FD5-0978-4914-9A9F-C3F596FC720E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Не пропускайте запрос**: заблокируйте или удалите его (drop).

* Именно на этом этапе выполняется проверка роли.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-babfdb7303a1ebc41a29df0a8e0da7f9900a0e71%2F%7B8DC352D5-6BD1-4A86-921D-ABCC671D43AE%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Продолжите процесс без этой проверки.

**Результат**

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

Оттуда можно удалить пользователя **carlos** и подтвердить лабораторную работу.

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e4d13c78eea07f6bdebd27f03d7c3c34e66b1a22%2F%7B4348027A-A520-4C3D-BBC6-0F1FA5ECC8F1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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/business-logic/failed-state-machine-workaround.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.
