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

# Contorno de Máquina de Estados com Falha

### Contorno de Autenticação via Máquina de Estados com Falhas

Este laboratório é baseado em suposições incorretas sobre a sequência de etapas no processo de autenticação. Ao usar esta máquina de estados mal projetada, é possível contornar a autenticação, acessar a interface de administração e excluir o usuário **carlos**.

Identificador fornecido:

* **Usuário:** wiener
* **Senha:** peter

**Observação principal**

O fluxo de conexão é dividido em várias etapas sucessivas, incluindo uma etapa intermediária de seleção de função.

A aplicação presume que todas as etapas são executadas na ordem e que cada solicitação foi validada corretamente antes de prosseguir para a próxima.

**Etapas da operação**

1. Conexão com credenciais `wiener:peter` válidas.
2. Após o login, a aplicação propõe uma etapa de **seleção de função**.

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

* Clique em avançar para prosseguir.
* No momento da solicitação GET para o **seletor de função**, intercepte a solicitação.

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

**Não deixe a solicitação seguir**: bloqueie ou exclua-a (drop).

* É nesta etapa que a validação da função é realizada.

<figure><img src="/files/86d21ca76376c24bc63b97159b4d7453f051fb38" alt=""><figcaption></figcaption></figure>

Continue o fluxo sem essa validação.

**Resultado**

A aplicação considera erroneamente que todas as etapas foram validadas corretamente. / O usuário acessa o \*\*painel de administração\*\* diretamente, sem ter selecionado ou validado uma função legítima.

A partir daí é possível remover o usuário **carlos** e validar o laboratório.

<figure><img src="/files/05a78508e8a69d85ecb61ec6b34ae7d8630cdbd6" 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 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/pt-br/web/business-logic/failed-state-machine-workaround.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.
