> 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-wfuzz-pentesting-web.md).

# SSRF Wfuzz

## Installation du premier scénario (vulnérabilité SSRF)

```bash
docker pull ubuntu:latest
docker run -dit --name ssrf_first_lab ubuntu
docker exec -it ssrf_first_lab bash
apt update
apt install apache2 php nano python3 lsof -y
service apache2 start
lsof -i:80 # vérifier que le site Web est actif

```

* Dans le répertoire **/var/www/html**, créez un fichier utility.php avec le contenu ci-dessous :

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] Liste du contenu du site Web " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] Aucune valeur n'a été fournie pour le paramètre URL/n/n";
}
?>

```

* Dans ce cas, le script ne fonctionne pas comme prévu. Vous devez modifier le fichier **"/etc/php/8.1/apache2/php.ini"** en définissant \_allow/\_url/*include* à "on". ![](/files/dcd156c2e0f97e2a5b648e37aaa429ab8b859b67) ![](/files/fe4f0cc9900b2bdad7cdfe07a3a8560ae6dcfc93)
* Créez un `login.html` fichier dans `/tmp/` pour simuler une page de connexion de production :

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Page de connexion </title>
<style>
Body {
  font-family: Calibri, Helvetica, sans-serif;
  background-color: pink;
}
button {
       background-color: #4CAF50;
       width: 100%;
        color: orange;
        padding: 15px;
        margin: 10px 0px;
        border: note;
        cursor: pointer;
         }
 form {
        border: 3px solid #f1f1f1;
    }
 input[type=text], input[type=password] {
        width: 100%;
        margin: 8px 0;
        padding: 12px 20px;
        display: inline-block;
        border: 2px solid green;
        box-sizing: border-box;
    }
 button:hover {
        opacity: 0.7;
    }
  .cancelbtn {
        width: auto;
        padding: 10px 18px;
        margin: 10px 5px;
    }
 .container {
        padding: 25px;
        background-color: lightblue;
    }
</style>
</head>
<body>
    <center> <h1> Formulaire de connexion étudiant (PRO) </h1> </center>
    <form>
        <div class="container">
            <label>Nom d'utilisateur : </label>
            <input type="text" placeholder="Entrez le nom d'utilisateur" name="username" required>
            <label>Mot de passe : </label>
            <input type="password" placeholder="Entrez le mot de passe" name="password" required>
            <button type="submit">Connexion</button>
            <input type="checkbox" checked="checked"> Se souvenir de moi
            <button type="button" class="cancelbtn"> Annuler</button>
            Mot de passe oublié <a href="#"> mot de passe ? </a>

    </form>
</body>
</html>

```

* Redémarrez le service apache2 après la modification :

  ```bash
  service apache2 restart

  ```
* Créez un serveur Web Python3 visible uniquement depuis le réseau interne :

```bash
python3 -m 4646 --bind 127.0.0.1

```

Schéma technique pour comprendre le premier scénario (**Il y a un site Web sur le port 8089 qui n'est visible que depuis les ordinateurs du réseau interne**):

<figure><img src="/files/88ff42631c4c26e84778abc2c33c48c73d81c13e" alt="" width="563"><figcaption></figcaption></figure>

Grâce au **utility.php** script, nous spécifions une URL et voyons qu'il l'interprète :

<figure><img src="/files/48ff0fcecddd1646b4c70696f9834702666ac301" alt=""><figcaption></figcaption></figure>

Si nous essayons de nous connecter depuis notre machine habituelle, **nous n'avons pas accès** au site Web :

<figure><img src="/files/0c2e9ffd43a25c87f9123d68bf09471e746d17a2" alt="" width="563"><figcaption></figcaption></figure>

Mais si nous nous connectons via **utility.php** et que nous fournissons l'URL du réseau interne, nous voyons qu'il l'interprète :

<figure><img src="/files/686501af241d74d94841633305fc7df8f36f100c" alt="" width="563"><figcaption></figcaption></figure>

Dans le cas hypothétique où **nous ne connaissons pas le port**, nous utilisons **Wfuzz** pour lancer une attaque par force brute :

```go
wfuzz -c -t 200 -z range,1-65535 "http://172.17.0.2/utility.php?url=http://127.0.0.1:FUZZ"

```

<figure><img src="/files/e29b669e91eada227f69eaaff35a1f82c00fc7d5" alt="" width="503"><figcaption></figcaption></figure>

Maintenant, nous, **filtrons** pour n'afficher que les sites Web avec une longueur différente de **4 caractères**:

```go
wfuzz -c -t 200 --hl=4  -z range,1-65535 "http://172.17.0.2/utility.php?url=http://127.0.0.1:FUZZ"

```

Il détecte les ports **80 et 4646**:

<figure><img src="/files/7f1bfd49b582a2c22bcc7275af14172e306f8534" alt="" width="563"><figcaption></figcaption></figure>


---

# 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-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-wfuzz-pentesting-web.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.
