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

# 允许你生成无限金钱的逻辑缺陷

### 无限金钱逻辑漏洞

**实验说明**

这个实验室在购买流程中存在一个逻辑缺陷。通过利用 \*\*礼品卡\*\*、\*\*促销优惠券\*\* 和 **订单确认**之间的不良交互，就可以无限制地生成余额，然后购买 Lightweight l33t 皮夹克。

提供的标识符：

* **用户**：wiener
* **密码**：peter

<figure><img src="/files/bab08525685b0875e713ffd905e8ba9ac2bfaf9d" alt=""><figcaption></figcaption></figure>

### 缺陷原理

注册订阅邮件后，会获得一张促销优惠券：

* **优惠券** : `SIGNUP30`

<figure><img src="/files/9e77275b87c6670a267a206f02278777f76efc02" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/87b33d5b3d8429c170b067d452115d8fc3f371ce" alt=""><figcaption></figcaption></figure>

在商店中可以购买 \*\*礼品卡\*\*。

问题在于，在购买这些卡时可以使用该优惠券。

<figure><img src="/files/8d0bc387d513f06d3ab7dae85f85107469bbfd42" alt=""><figcaption></figcaption></figure>

#### 初始利用示例

* 购买一张面值为 **$10**
* 优惠券应用 `SIGNUP30`
* 最终支付价格： **$7**

<figure><img src="/files/898ca974daf47b465674f7a9cb775abcb009b860" alt=""><figcaption></figcaption></figure>

* 收到一份 **礼品卡代码** （例如： `DbWseYFi2v`)

<figure><img src="/files/abe52d310228ecc802b5875e151f81d4d857d6b9" alt=""><figcaption></figcaption></figure>

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

当在礼品卡部分使用此代码时，账户余额增加 **10$** 而只花费了 **7$** 。

因此净收益为 **$3**，将总余额增加到 **$103**.

<figure><img src="/files/2ab99c941c9174d355ef331bfd768f4dd8c21624" alt=""><figcaption></figcaption></figure>

### 识别出的逻辑问题

1. 该优惠券可以 **多次** 用于购买礼品卡。
2. 礼品卡的金额 **仍按全额计入**，无论实际支付的价格是多少。
3. 通过以下端点进行订单确认：

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

允许动态提取礼品卡代码。

没有任何限制阻止此过程自动化。

<figure><img src="/files/bc07859b8c02be68473a32fa08adeb4a8e07bb13" alt=""><figcaption></figcaption></figure>

### 攻击自动化（宏）

为了利用这一大规模缺陷， **Burp Suite 宏** 被实现。

<figure><img src="/files/61cb70f2f42124781adbe892ca4b91dd385dc707" alt=""><figcaption></figcaption></figure>

#### 宏中拦截的请求

1. 添加一个商品 **礼品卡** 到购物车
2. 应用订阅优惠券（`SIGNUP30`)
3. 订单验证（`提交订单`)
4. 获取订单确认响应
5. 将礼品卡登记到用户账户

<figure><img src="/files/425ea04cf82a3ba0166ee40e2e906b89d75d66d2" alt=""><figcaption></figcaption></figure>

#### 宏的关键点

* 该 **礼品卡代码** 会动态提取自 `cart/order-confirmation` 响应。

<figure><img src="/files/425fa1976d11a0d300bbe1ba43ed84f07acf9254" alt=""><figcaption></figcaption></figure>

* 然后通过向礼品卡管理端点发送 POST 请求重新注入该代码。
* 一个自定义的 **参数** 会在 GET 查询中设置以存储代码值。

<figure><img src="/files/7a419550f808c5407ff51a804c9ba20c3cd9b3f1" alt=""><figcaption></figcaption></figure>

应用的优惠券会从之前的查询中恢复其值，从而可以自动重复使用。

<figure><img src="/files/408b3d47b80224f7f892e216514988d9d1e2d753" alt=""><figcaption></figcaption></figure>

### 批量执行

一旦配置好宏：

所有对 **URL 范围** 的请求都会自动触发该宏。

* 一个 **Intruder** 查询会发送到站点根路径。
* 配置：
* **500 个请求**
* **有效载荷为空**

<figure><img src="/files/04adf03f099d48878fb1216a06bffbede13d2b92" alt=""><figcaption></figcaption></figure>

**资源池** 限制为 **1 个并发请求**

<figure><img src="/files/0a5aa8b1f87dac8cacfbe9af3c20ec01149ca4ee" alt="" width="364"><figcaption></figcaption></figure>

这种方法可以将礼品卡的购买、确认和入账无缝串联起来。

#### 结果

账户余额会无限增长。/ 一旦累积了足够的余额，购买 **Lightweight l33t 皮夹克** 就可以在没有资金限制的情况下实现。

<figure><img src="/files/824cbdc9782a9f3a857ff3418ee845a5038d8cc9" 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 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/business-logic/logical-flaw-allowing-you-to-generate-infinite-money.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.
