> 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/host-header/authentication-bypass-via-host-header.md).

# Обход аутентификации через заголовок Host

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

### Обход аутентификации через заголовок Host

**Описание лабораторной работы**

Эта лабораторная работа основана на ошибочном предположении на стороне сервера: уровень привилегий пользователя определяется на основе значения HTTP-заголовка **Host**. / Обрабатывая этот заголовок, можно получить доступ к функциям, зарезервированным для администратора.

\*\* Цель:\*\*/ Перейдите в панель администратора и удалите пользователя **carlos**.

\*\* Наблюдаемое начальное поведение\*\*

Когда пытаются получить доступ к странице администратора с обычным запросом, доступ запрещён.

Классический запрос:

```http
GET /admin HTTP/2
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

Ответ: несанкционированный доступ

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f9c9c4f4b26bdd61bd2d0f367553a2c331369a12%2F%7B4B62D5F6-47B4-43E0-BF43-128A8E37AB47%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Анализ уязвимости**

Похоже, приложение предоставляет повышенные привилегии, когда запрос поступает с хоста, который считается «внутренним» или доверенным, например **localhost**. / Дополнительная проверка для подтверждения фактического источника запроса не выполняется.

```http
Host: 0aa100b30336117186f29ede001a0029.web-security-academy.net
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8e1f18327882169c267bbc9c8a5ebe2ed5f546c8%2F%7BD870FDF8-AE94-45F6-AF36-3914D2F04AB3%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Эксплуатация**

Просто вручную измените **Host** значение заголовка в HTTP-запросе.

Изменённый запрос:

```http
Host: localhost
```

Результат: авторизованный доступ к панели администратора

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6edf77cd803d2947cb21270144fcf8f5a279e569%2F%7BD9A1CBB4-5DE0-4245-B55A-E1D004716379%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Финальное действие**

После получения доступа администратора можно удалить целевого пользователя:

```bash
/admin/delete?username=carlos
```

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a61f1349fc303bf9ea5189f33854ceb0191b7436%2F%7B213232A9-74E3-4DCB-A156-C15A888B25F2%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/host-header/authentication-bypass-via-host-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.
