> 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

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

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

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

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

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

При попытке получить доступ к странице администратора стандартным запросом доступ запрещён.

Обычный запрос:

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

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

<figure><img src="/files/1d033b0cf350a518cd6444e7e959ea2b80e97a4e" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

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

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

```http
Host: localhost
```

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

<figure><img src="/files/52f2ca3b0cc1574a243bc24637584c748bc1f12d" alt=""><figcaption></figcaption></figure>

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

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

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

<figure><img src="/files/c27179bdb9f34a937f4468973d7c341de5215222" 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/host-header/authentication-bypass-via-host-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.
