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

# SSRF Wfuzz

## Установка первого сценария (уязвимость 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 # проверить, что веб-сайт активен

```

* В каталоге **/var/www/html**, создайте файл utility.php со следующим содержимым:

```php
<?php
if (isset($_GET['url'])) {
    $url = $_GET['url'];
    echo "/n[+] Содержимое веб-сайта " . $url . ":/n/n";
    include($url);
} else {
    echo "/n[!] Значение для параметра URL не было предоставлено/n/n";
}
?>

```

* В этом случае скрипт не работает как ожидается. Вам нужно изменить файл **"/etc/php/8.1/apache2/php.ini"** путём установки \_allow/\_url/*include* в "on". ![](/files/54439f7e906d8d9afc9dbf7944afb350301e6855) ![](/files/061b62225d22537385cc171a838a12b679336f02)
* Создайте `login.html` файл в `/tmp/` для имитации рабочей страницы входа:

```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Страница входа </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> Форма входа студента (PRO) </h1> </center>
    <form>
        <div class="container">
            <label>Имя пользователя: </label>
            <input type="text" placeholder="Введите имя пользователя" name="username" required>
            <label>Пароль: </label>
            <input type="password" placeholder="Введите пароль" name="password" required>
            <button type="submit">Войти</button>
            <input type="checkbox" checked="checked"> Запомнить меня
            <button type="button" class="cancelbtn"> Отмена</button>
            Забыли <a href="#"> пароль? </a>

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

```

* Перезапустите службу apache2 после изменения:

  ```bash
  service apache2 restart

  ```
* Создайте веб-сервер Python3, видимый только из внутренней сети:

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

```

Техническая схема для понимания первого сценария (**На порту 8089 есть веб-сайт, который виден только с компьютеров внутренней сети**):

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

Благодаря **utility.php** скрипту, мы указываем URL и видим, что он его интерпретирует:

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

Если мы попытаемся подключиться с нашей обычной машины, **у нас нет доступа** к веб-сайту:

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

Но если мы подключимся через **utility.php** и укажем URL внутренней сети, мы видим, что он его интерпретирует:

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

В гипотетическом случае, когда **мы не знаем порт**, мы используем **Wfuzz** для запуска атаки перебором:

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

Теперь мы, **фильтруем** чтобы показать только веб-сайты с другой **длиной 4 символа**:

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

```

Он обнаруживает порты **80 и 4646**:

<figure><img src="/files/f861669a0cefc049a80a9ff715a48d6a05688b2f" 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/ru/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.
