> 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

Заметки по лабораторным работам PortSwigger Web Security Academy о контроле доступа на основе заголовка Referer, включая рабочий процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст устранения уязвимости.

### Контроль доступа на основе 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5928f7d223e6026d026afc2611d7deb76903c973%2F%7B4FB731A4-75CC-41AA-9204-B4FCA7BD97AB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e1da62dc2bf8a9925232eebbf2372f77af8c9d06%2F%7BD7334A97-937F-4269-BDA5-FFCF078F35E0%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/web/access-control/access-control-based-on-the-referer-header.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
