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

# Poorly Applied Business Rules

Poorly Applied Business Rules notes for PortSwigger Web Security Academy labs, including exploitation workflow, payload testing, Burp Suite validation, and remediation context.

### Flawed Enforcement of Business Rules

This lab contains a logical flaw in the purchasing process. / The objective is to exploit this weakness in order to buy a \*\*

Identifier provided:

* **User**: `wiener`
* **Password**: `peters`

**Coupon system analysis**

After login, the site automatically provides a welcome coupon:

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

**NEWCUST5** → reduction of 5 €

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

Then, by subscribing to the newsletter, a second coupon is given:

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

* **SIGNUP30** → reduction of 30 €

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

Each coupon is valid individually and works correctly when used alone.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3ec29fa020490c21ca627a6ddab19443942ecdcb%2Fimage%20(234).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

**Problem of business logic**

The system applies insufficient verification on the use of coupons:

* Validation controls only \*\* the last coupon applied\*\*
* There is no overall verification\*\* that prevents re-use or chaining of the same coupons

**Operation of the fault**

By alternating the two coupons, it is possible to bypass the expected logic:

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

Each new coupon is accepted because the audit compares only the previous coupon.

**Result**

By repeating this sequence, the total price of the jacket is gradually reduced to:

* **Total : 0 €**

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-40a2f4141be00a536b2d377abade80e75a48d0e0%2Fimage%20(236).png?alt=media" 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 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/web/business-logic/flawed-business-rules.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.
