> 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/business-logic/logical-flaw-allowing-you-to-generate-infinite-money.md).

# 無限にお金を生成できる論理的欠陥

無限にお金を生成できる論理的欠陥の PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### 無限資金のロジックの欠陥

**ラボの説明**

このラボには、購入プロセスに論理的な欠陥があります。\*\*ギフトカード\*\*、\*\*プロモーションクーポン\*\*、および **注文確認**、クレジットを無制限に生成でき、その後 Lightweight l33t レザージャケットを購入できます。

提供された識別子:

* **ユーザー**: wiener
* **パスワード**: peter

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d6266562de36e2204ea2a273ddcc86d4cde9b77a%2F%7BB513ED00-D597-4B79-A334-DA892468C359%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 不具合の原理

ニュースレターに登録すると、プロモーションクーポンが付与されます：

* **クーポン** : `SIGNUP30`

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cec3ae61aa8aa88dfce9fdb38e896f416bcb2d8d%2F%7BD56D3280-BB4D-43F8-8847-6272878AAA4B%7D.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-4facaaf5bc9fb5535fa62262eaefe8e69dbaa337%2F%7BAD53D7B2-725A-4FFC-95FD-DFA14AF52FE4%7D.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-638bd9d523a18f5fbc134ee4c3e1881a831a5357%2F%7BA5CC399E-BDD2-43A3-AC1A-7FF29C413D6D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 初期の悪用例

* 〜のギフトカードの購入 **$10**
* クーポン適用 `SIGNUP30`
* 最終支払額： **$7**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2b0c49ff4d33bdf84258dd94c311db53c0605d76%2F%7B218DFB98-4FA8-49E4-870E-3E1BD7F2B23A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* 〜の受領 **ギフトカードコード** (例： `DbWseYFi2v`)

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bf544400cbdd52f0edd21528a147adf250381bd9%2F%7B05028327-3014-4261-AC5C-87AE4946C996%7D.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-15228b23eb9e8d5f47d4f9499c64b44caf503f82%2F%7B2922EBC9-E4DA-4AFA-BF5C-77AFE41E241B%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

このコードをギフトカードセクションで使用すると、アカウント残高が **10$** わずか **7$** が支払われました。

したがって、純増は **$3**となり、合計クレジットは **$103**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5cfa35b4bf87c872cc9d6bb96abafaa4fb2c80cd%2F%7B5F7BEF80-054D-4C94-8965-2D2DDB5EB7D4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 確認されたロジック上の問題

1. そのクーポンは **複数回** ギフトカードの購入に使用できます。
2. ギフトカードのクレジットは **依然として全額で適用されます**、実際に支払った価格に関係なく。
3. エンドポイント経由の注文確認：

   ```bash
   /cart/order-confirmation?order-confirmed=true
   ```

ギフトカードコードを動的に取得できます。

このプロセスの自動化を妨げる制限はありません。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-55e2eabaee74030c602861c50f46a4dd23222418%2F%7B9C7CB844-596C-4813-8814-5CD251A30BE7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 攻撃の自動化（マクロ）

大規模な不具合を悪用するために、 **Burp Suite マクロ** が実装されます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27e5c0020d46100245515c8757fda9e0d537b793%2F%7BC0FB1618-3BD6-4892-8DD0-09C160A6911E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### マクロで傍受されるリクエスト

1. 商品を追加 **ギフトカード** をカートに追加
2. ニュースレタークーポンの適用（`SIGNUP30`)
3. 注文の検証（`注文を確定`)
4. 注文確認レスポンスの取得
5. ユーザーアカウントへのギフトカード登録

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0c7ded1307665efdedff408fffc7c0c44263d3e5%2F%7BA0690E08-23D1-409E-85CF-82E673868463%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### マクロの重要ポイント

* その **ギフトカードコード** は動的に取得されます `cart/order-confirmation` レスポンス。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-322587d183fd337eacf0b571ecefa119f9f85dde%2F%7B509B7CC2-BE19-44A3-9990-84933C1553E9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* このコードはその後、POSTリクエストでギフトカード管理エンドポイントに再注入されます。
* カスタム **パラメータ** は、コード値を保存するためにGETクエリに設定されます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9bca90655a458d0f44ef9b653d82e1eea128ff43%2F%7B147C5FCB-AA53-4DDF-8B09-ADE105FABEF6%7D.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-9c9764756e9d9cfb63a9a9054dad2bc4e8068a43%2F%7B0B3C9369-8100-4A35-AF59-3DB19D928851%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### 一括実行

マクロを設定すると：

すべての **URLスコープの** リクエストで自動的にマクロが起動します。

* A **Intruder** クエリはサイトのルートに送信されます。
* 設定：
* **500件のリクエスト**
* **ペイロード null**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6faa199c2f98a292c939ce81df7669a9096245f4%2F%7BFB2280E9-9ABE-4875-93B2-CBD08DCB4B7B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**リソースプール** 〜に制限 **同時リクエスト1件**

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8c20676ac7b015e7dae383d1e5a649146196c9f0%2F%7B7B673C75-A05B-4061-8C29-80E55C2DBF87%7D.png?alt=media" alt="" width="364"><figcaption></figcaption></figure>

この方法により、ギフトカードの購入、確認、クレジット付与を途切れることなく連鎖させることが可能になります。

#### 結果

アカウント残高は無限に増加します。／十分なクレジットが蓄積されると、〜の購入が **Lightweight l33t レザージャケット** 金銭的制約なしに可能になります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e6e2cd1996c83495734638cd08179a54e2a5cbf5%2F%7B9EBF5FDD-31DC-41F4-9B62-DC0272D14FDD%7D.png?alt=media" alt="" width="375"><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/business-logic/logical-flaw-allowing-you-to-generate-infinite-money.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.
