> 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/low-level-logic-flaw.md).

# 低レベルのロジック障害

低レベルのロジック障害の PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### ビジネスルールの実施不備

**ラボの説明**

このラボには、購入プロセスにおける\*\*論理的欠陥\*\*が含まれています。業務ルールの適用が不十分なため、バスケットの計算を操作して、「Lightweight l33t leather jacket」を予期しない価格で購入することが可能です。

提供された識別子:

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

**行動分析**

バスケットに商品を追加する際、次のクエリが使用されます:

```bash
productId=1&redir=PRODUCT&quantity=99
```

このパラメータは送信できます **大量に** 累積値を厳密に制御することなく。

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

クエリは次に送信されます **Intruder** で null ペイロードを設定し **無期限に続行** モードで、最大 **1 件の同時リクエスト**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e6f606e8d1b9d1655ebf921062dbe505ec34876a%2Fimage%20(3102).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-9625ca79563b6a9a4c4b7b16de0b8b894016e9b1%2F%7B9260219F-93F4-425E-972E-02CE1FAE4B8F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**問題の原因**

脆弱性は符号付き **オーバーフローに起因します**。/ アプリケーションは **32ビット符号付き整数**を使用しており、その範囲は次のとおりです:

* 最小値: `-2 147 483 648`
* 最大値: `2 147 483 647`

合計が許容最大値を超えると、 **負の値に再計算されます** 算術オーバーフローのためです。

**不十分な制御**

アプリケーションが合計が0未満のときに支払いを防いでも、 **途中計算では正しい検証が行われません**.

これにより、最終金額が正で、かつ非常に低くなるまでバスケットを調整できます。

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

**最終計算の調整**

\*\*0ドルより大きく100ドル未満\*\*の金額を得るには、次の計算を行います:

* ジャケットの価格: **$1,337**
* オーバーフローを引き起こすために必要な値: \**14 018 329* \*
* 計算:

  ```bash
  14 018 329 / 1337 ≈ 10 484回
  ```

バッチ送信 (`数量 = 99`):

```bash
10,484 / 99 ≈ 105件のリクエスト
```

**最終カート構成**

オーバーフロー後に有効な合計を得るには:

* **32 123** 1337ドルのジャケット
* **21** Baby minding shoes 60.79ドル
* **最終合計:** **$54.63**


---

# 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/low-level-logic-flaw.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.
