> 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ócios aplicadas de forma inadequada

Notas sobre regras de negócios aplicadas de forma inadequada para os laboratórios do PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payload, validação no Burp Suite e contexto de remediação.

### Aplicação falha das regras de negócio

Este laboratório contém uma falha lógica no processo de compra. / O objetivo é explorar essa fraqueza 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="https://783634792-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** → redução de 5 €

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

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

<figure><img src="https://783634792-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** → redução de 30 €

<figure><img src="https://783634792-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 cupom é válido individualmente e funciona corretamente quando usado sozinho.

<figure><img src="https://783634792-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 negócio**

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

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

**Funcionamento da falha**

Alternando os dois cupons, é possível contornar a lógica esperada:

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

Cada novo cupom é aceito porque a auditoria 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="https://783634792-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/pt-br/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.
