> 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/flawed-business-rules.md).

# 应用不当的业务规则

### 业务规则执行缺陷

本实验室包含一个购买流程中的逻辑缺陷。/ 目标是利用这个弱点来购买一件 \*\*

提供的标识符：

* **用户**: `wiener`
* **密码**: `彼得斯`

**优惠券系统分析**

登录后，网站会自动提供一张欢迎优惠券：

<figure><img src="/files/0b356dec3b108216625e71cc8b20f0ff91e4a853" alt=""><figcaption></figcaption></figure>

**NEWCUST5** → 减免 5 欧元

<figure><img src="/files/0599320c5256b7bc5f20d0deb4c54c8f6c2021d5" alt=""><figcaption></figcaption></figure>

然后，订阅新闻简报后，会获得第二张优惠券：

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

* **SIGNUP30** → 减免 30 欧元

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

每张优惠券单独有效，单独使用时也能正常工作。

<figure><img src="/files/7148846353eee0fed72bf1f751ca039f6f037f43" alt="" width="563"><figcaption></figcaption></figure>

**业务逻辑问题**

系统对优惠券的使用验证不足：

* 验证只检查\*\*最后使用的优惠券\*\*
* 没有\*\*整体验证\*\*来防止重复使用或串联使用相同优惠券

**漏洞运作方式**

通过交替使用这两张优惠券，可以绕过预期的逻辑：

```bash
NEWCUST5
SIGNUP30
NEWCUST5
SIGNUP30
NEWCUST5
SIGNUP30
```

每一张新优惠券都会被接受，因为审计只会比较上一张优惠券。

**结果**

通过重复这一序列，夹克的总价会逐渐降至：

* **总计：0 欧元**

<figure><img src="/files/d8e96e7f6ec74e5bcba1089173367e44bfd0320a" 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 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/flawed-business-rules.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.
