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

# Regras de Negócio Mal Aplicadas

### Aplicação Defeituosa das Regras de Negócio

Este laboratório contém uma falha lógica no processo de compra. / O objetivo é explorar essa vulnerabilidade para comprar um \*\*

Identificador fornecido:

* **Usuário**: `wiener`
* **Senha**: `peters`

**Análise do sistema de cupons**

Após o login, o site fornece automaticamente um cupom de boas-vindas:

<figure><img src="/files/172f57f2b601581be93b2ebfc92a2145d4cf5696" alt=""><figcaption></figcaption></figure>

**NEWCUST5** → desconto de 5 €

<figure><img src="/files/76f49c4890452cbe7976059ea7db9f9557f8ed9c" alt=""><figcaption></figcaption></figure>

Em seguida, ao se inscrever na newsletter, um segundo cupom é fornecido:

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

* **SIGNUP30** → desconto de 30 €

<figure><img src="/files/12d0e37f2d78d16ef9aa02fb3b6d3d36dfd02ba5" alt=""><figcaption></figcaption></figure>

Cada cupom é válido individualmente e funciona corretamente quando usado sozinho.

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

**Problema de lógica de negócio**

O sistema aplica uma verificação insuficiente no uso de cupons:

* A validação controla apenas \*\*o último cupom aplicado\*\*
* Não há verificação geral\*\* que impeça a reutilização ou o encadeamento dos mesmos cupons

**Funcionamento da falha**

Ao alternar entre os dois cupons, é possível contornar a lógica esperada:

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

Cada novo cupom é aceito porque a verificação compara apenas o cupom anterior.

**Resultado**

Ao repetir essa sequência, o preço total da jaqueta é gradualmente reduzido para:

* **Total : 0 €**

<figure><img src="/files/555f1018171d5f85d35ea657a6b5c404f828c1f0" 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/pt-br/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.
