> 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/high-level-logic-vulnerability.md).

# Vulnérabilité logique de haut niveau

Notes sur la vulnérabilité logique de haut niveau pour les laboratoires de la PortSwigger Web Security Academy, incluant le workflow d’exploitation, les tests de payloads, la validation dans Burp Suite et le contexte de remédiation.

### Vulnérabilité logique de haut niveau

**Description du laboratoire**

Ce laboratoire ne valide pas correctement les données fournies par l’utilisateur. Il est possible d’exploiter une faille logique dans le processus d’achat afin de modifier le prix final des articles. / L’objectif est d’acheter le \*\*

Identifiant fourni :

* **Utilisateur**: wiener
* **Mot de passe**: peter

**Analyse du fonctionnement du panier**

Lorsqu’un produit est ajouté au panier, la requête envoyée ressemble à ceci :

```bash
productId=1&redir=PRODUCT&quantity=1
```

Le `Le paramètre` quantity est directement contrôlé par le client et n’est pas correctement vérifié côté serveur.

**Exploitation de la faille logique**

Si la quantité est modifiée avec une valeur négative, par exemple :

```bash
productId=1&redir=PRODUCT&quantity=-1
```

Le montant total du panier diminue, ce qui entraîne un prix négatif (par ex. \*\* 1337 $\*\*).

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8acde11cbf9c6e452a287c320078803934e39e43%2Fimage%20(216).png?alt=media" alt=""><figcaption></figcaption></figure>

Cependant, lors de la validation du panier, l’application bloque ce cas avec le message suivant :

> *Le prix total du panier ne peut pas être inférieur à zéro*

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-41fa5b77d97316389bd175440d43d78deca2b277%2Fimage%20(217).png?alt=media" alt=""><figcaption></figcaption></figure>

**Contournement de la restriction**

Pour exploiter la vulnérabilité :

Ajoutez le **veste cible** avec une quantité valide :

```bash
productId=1&redir=PRODUCT&quantity=1
```

Ajoutez ensuite un autre produit avec un montant négatif pour réduire le total :

```bash
productId=2&redir=PRODUCT&quantity=-100
```

Cela donne un total fortement négatif (par ex. **-$6241.00**).

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db6d0a58cfd28884432dd1fa84d4b5a913fc6dda%2Fimage%20(218).png?alt=media" alt=""><figcaption></figcaption></figure>

Ajustez le montant négatif (par ex. `-17`) afin que le total final reste **positif**, mais très faible (inférieur à 100 $).

<figure><img src="https://3840167291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e028396766a54310bef40d6aa24e67fa4a6f2abd%2Fimage%20(220).png?alt=media" alt=""><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/fr/web/business-logic/high-level-logic-vulnerability.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.
