> 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 de negocio aplicadas de forma deficiente

Notas sobre Reglas de negocio aplicadas de forma deficiente para los laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payload, validación en Burp Suite y contexto de mitigación.

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

Este laboratorio contiene un fallo lógico en el proceso de compra. / El objetivo es explotar 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="https://754079710-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** → descuento de 5 €

<figure><img src="https://754079710-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>

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

<figure><img src="https://754079710-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** → descuento de 30 €

<figure><img src="https://754079710-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>

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

<figure><img src="https://754079710-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>

**Problema de lógica de negocio**

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

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

**Funcionamiento de la falla**

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="https://754079710-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/es/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.
