> 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/access-control/bypassing-access-control-based-on-http-method.md).

# Contornando o Controle de Acesso Baseado no Método HTTP

### O controle de acesso baseado no método pode ser contornado

Neste laboratório, os controles de acesso são parcialmente baseados no método HTTP usado. Após conectar-se com *administrator:admin* credenciais, o painel de administração pode ser visualizado livremente.

O objetivo é conectar-se com *wiener:peter* credenciais e explorar a implementação incorreta do controle para atribuir a função de administrador.

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

Após conectar-se como administrador, descobrimos a interface para aumentar ou diminuir os privilégios de um usuário. / Ao interceptar a requisição enviada durante uma modificação:

```http
POST /admin-roles
username=carlos&action=upgrade
```

Essa ação requer privilégios administrativos quando enviada em **POST**.

No entanto, ao tentar reproduzir esta requisição com a sessão wiener, a aplicação retorna uma mensagem de acesso negado.

<figure><img src="/files/22be4c21eeb29d54d0387f68c0ae199c4ce49c9d" alt=""><figcaption></figcaption></figure>

No entanto, se o método POST for substituído por **GET**, o controle falha:

```http
GET /admin-roles?username=wiener&action=upgrade
```

Esta requisição é aceita e retorna um **200 OK**, o que permite elevar os privilégios de wiener ao cargo de administrador.

<figure><img src="/files/1d6b3a78fc7075cae83af2ed747e7c1dbf1baff0" 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/access-control/bypassing-access-control-based-on-http-method.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.
