> 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/de/web/business-logic/low-level-logic-flaw.md).

# Logischer Fehler auf niedriger Ebene

Notizen zum logischen Fehler auf niedriger Ebene für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Fehlerhafte Durchsetzung der Geschäftsregeln

**Beschreibung des Labs**

Dieses Labor enthält einen \*\* logischen Fehler im Kaufprozess\*\*. Aufgrund der schlechten Anwendung von Geschäftsregeln ist es möglich, die Berechnung des Warenkorbs zu manipulieren, um eine "Leichte l33t-Lederjacke" zu einem unerwarteten Preis zu kaufen.

Bereitgestellte Kennung:

* **Benutzer:** wiener
* **Passwort:** peter

**Verhaltensanalyse**

Beim Hinzufügen eines Produkts zum Warenkorb wird die folgende Abfrage verwendet:

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

Dieser Parameter kann **eine große Anzahl von Malen** ohne strikte Kontrolle des kumulativen Werts gesendet werden.

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

Die Abfrage wird an **Intruder** mit einer Null-Nutzlast, konfiguriert in **Unbegrenzt fortfahren** Modus und maximal **1 gleichzeitige Anfrage**.

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

Nach genügend Iterationen wird der **Gesamtpreis des Warenkorbs negativ**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9625ca79563b6a9a4c4b7b16de0b8b894016e9b1%2F%7B9260219F-93F4-425E-972E-02CE1FAE4B8F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Ursache des Problems**

Die Schwachstelle stammt von einem vorzeichenbehafteten **Überlauf**. / Die Anwendung verwendet eine **vorzeichenbehaftete 32-Bit-Ganzzahl**, deren Grenzen sind:

* Minimalwert : `-2 147 483 648`
* Maximalwert : `2 147 483 647`

Wenn die Gesamtsumme den maximal zulässigen Wert überschreitet, wird sie **in negative Werte neu berechnet** aufgrund eines arithmetischen Überlaufs.

**Unzureichende Kontrollen**

Auch wenn die Anwendung die Zahlung verhindert, wenn die Gesamtsumme unter 0 liegt, **wird bei den Zwischenschritten keine korrekte Überprüfung durchgeführt**.

Dadurch können Sie den Warenkorb anpassen, bis Sie einen positiven, aber sehr niedrigen Endbetrag erhalten.

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

**Anpassung der Endberechnung**

Um einen Betrag \*\* über 0 $ und unter 100 $\*\* zu erhalten, wird die folgende Berechnung durchgeführt:

* Kosten der Jacke: **$1,337**
* Erforderlicher Wert, um den Überlauf zu verursachen: \**14 018 329* \*
* Berechnung:

  ```bash
  14 018 329 / 1337 ≈ 10 484-mal
  ```

Stapelübermittlung (`quantity = 99`):

```bash
10.484 / 99 ≈ 105 Anfragen
```

**Endgültige Warenkorbzusammensetzung**

Um nach dem Überlauf eine gültige Gesamtsumme zu erhalten:

* **32 123** Jacken zu 1337 $
* **21** Babybetreuungs-Schuhe zu 60,79 $
* **Endsumme:** **$54.63**


---

# 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/de/web/business-logic/low-level-logic-flaw.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.
