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

# Reglas empresariales mal aplicadas

### Aplicación defectuosa de las reglas de negocio

Este laboratorio contiene una falla lógica en el proceso de compra. / El objetivo es aprovechar esta debilidad para comprar un \*\*

Identificador proporcionado:

* **Usuario**: `wiener`
* **Contraseña**: `peters`

**Análisis del sistema de cupones**

Después de iniciar sesión, el sitio proporciona automáticamente un cupón de bienvenida:

<figure><img src="/files/6e596dab3303a25c26fb22e188c8ebede949b56c" alt=""><figcaption></figcaption></figure>

**NEWCUST5** → reducción de 5 €

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

Luego, al suscribirse al boletín, se obtiene un segundo cupón:

<figure><img src="/files/3b29232df30fff7251b107cefff183370c7b3ba2" alt=""><figcaption></figcaption></figure>

* **SIGNUP30** → reducción de 30 €

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

Cada cupón es válido individualmente y funciona correctamente cuando se usa por separado.

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

**Problema de lógica de negocio**

El sistema aplica una verificación insuficiente sobre el uso de cupones:

* La validación solo controla \*\*el último cupón aplicado\*\*
* No existe una verificación global\*\* que impida la reutilización o el encadenamiento de los mismos cupones

**Funcionamiento del fallo**

Alternando los dos cupones, es posible eludir la lógica esperada:

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

Cada nuevo cupón se acepta porque la auditoría compara solo el cupón anterior.

**Resultado**

Al repetir esta secuencia, el precio total de la chaqueta se reduce gradualmente hasta:

* **Total : 0 €**

<figure><img src="/files/6a47624b40bffcee56fc7ed92b3dda8686423139" 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/es/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.
