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

# Règles métier mal appliquées

### Application défectueuse des règles métier

Ce laboratoire contient une faille logique dans le processus d'achat. / L'objectif est d'exploiter cette faiblesse afin d'acheter un \*\*

Identifiant fourni :

* **Utilisateur**: `wiener`
* **Mot de passe**: `peters`

**Analyse du système de coupons**

Après connexion, le site fournit automatiquement un coupon de bienvenue :

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

**NEWCUST5** → réduction de 5 €

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

Puis, en s'abonnant à la newsletter, un deuxième coupon est attribué :

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

* **SIGNUP30** → réduction de 30 €

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

Chaque coupon est valable individuellement et fonctionne correctement lorsqu'il est utilisé seul.

<figure><img src="/files/942837764c0f2972d32b2befac2987ebedeb0b20" alt="" width="563"><figcaption></figcaption></figure>

**Problème de logique métier**

Le système applique une vérification insuffisante lors de l'utilisation des coupons :

* La validation ne contrôle que \*\* le dernier coupon appliqué\*\*
* Il n'existe pas de vérification globale\*\* empêchant la réutilisation ou l'enchaînement des mêmes coupons

**Fonctionnement de la faille**

En alternant les deux coupons, il est possible de contourner la logique attendue :

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

Chaque nouveau coupon est accepté car l'audit ne compare que le coupon précédent.

**Résultat**

En répétant cette séquence, le prix total de la veste est progressivement réduit à :

* **Total : 0 €**

<figure><img src="/files/320c1cc0f79b13316fbadd1e71b5f5c63bb6bd57" 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/fr/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.
