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

# Неправильно применённые бизнес-правила

### Ошибочная реализация бизнес-правил

В этой лабораторной работе есть логическая ошибка в процессе покупки. / Цель — использовать эту уязвимость, чтобы купить \*\*

Предоставленный идентификатор:

* **Пользователь**: `wiener`
* **Пароль**: `Питерс`

**Анализ системы купонов**

После входа на сайт автоматически выдаётся приветственный купон:

<figure><img src="/files/4dad63aed6f764c3a90af0ef3af171a534b02a7c" alt=""><figcaption></figcaption></figure>

**NEWCUST5** → скидка 5 €

<figure><img src="/files/2642377d04bed04a174941934c989847a8286600" alt=""><figcaption></figcaption></figure>

Затем при подписке на рассылку выдаётся второй купон:

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

* **SIGNUP30** → скидка 30 €

<figure><img src="/files/13e486e9fbd5e5a26b1e5e5201c368400ad296dc" alt=""><figcaption></figcaption></figure>

Каждый купон действителен отдельно и корректно работает при использовании по отдельности.

<figure><img src="/files/8f1c7fbe3a144acafd04b599f4c3630b9b126caa" alt="" width="563"><figcaption></figcaption></figure>

**Проблема бизнес-логики**

Система применяет недостаточную проверку при использовании купонов:

* Проверка контролирует только \*\*последний применённый купон\*\*
* Нет общей проверки\*\*, предотвращающей повторное использование или последовательное применение тех же купонов

**Принцип действия уязвимости**

Чередуя эти два купона, можно обойти ожидаемую логику:

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

Каждый новый купон принимается, потому что проверка сравнивает только предыдущий купон.

**Результат**

При повторении этой последовательности общая цена куртки постепенно уменьшается до:

* **Итого: 0 €**

<figure><img src="/files/0cb5a50bb0dc9d45ea61f4c9a07929727539826c" 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/ru/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.
