> 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/logical-flaw-allowing-you-to-generate-infinite-money.md).

# Logischer Fehler, der das Erzeugen von unendlich viel Geld ermöglicht

Notizen zum logischen Fehler, der das Erzeugen von unendlich viel Geld ermöglicht, für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Logikfehler mit unendlichem Geld

**Beschreibung des Labs**

Dieses Labor enthält einen Logikfehler im Kaufprozess. Durch eine schlechte Interaktion zwischen \*\*Geschenkkarten\*\*, \*\*Werbecoupons\*\* und **Bestellbestätigung**, ist es möglich, unbegrenzt Guthaben zu erzeugen und dann die Lightweight l33t Lederjacke zu kaufen.

Bereitgestellte Kennung:

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d6266562de36e2204ea2a273ddcc86d4cde9b77a%2F%7BB513ED00-D597-4B79-A334-DA892468C359%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Fehlerprinzip

Nach der Anmeldung zum Newsletter wird ein Werbecoupon vergeben:

* **Coupon** : `SIGNUP30`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cec3ae61aa8aa88dfce9fdb38e896f416bcb2d8d%2F%7BD56D3280-BB4D-43F8-8847-6272878AAA4B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4facaaf5bc9fb5535fa62262eaefe8e69dbaa337%2F%7BAD53D7B2-725A-4FFC-95FD-DFA14AF52FE4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Im Shop ist es möglich, \*\*Geschenkkarten\*\* zu kaufen.

Das Problem ist, dass der Coupon beim Kauf dieser Karten angewendet werden kann.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-638bd9d523a18f5fbc134ee4c3e1881a831a5357%2F%7BA5CC399E-BDD2-43A3-AC1A-7FF29C413D6D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Beispiel für erste Ausnutzung

* Kauf einer Geschenkkarte im Wert von **$10**
* Anwendung des Coupons `SIGNUP30`
* Bezahlt Endpreis: **$7**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2b0c49ff4d33bdf84258dd94c311db53c0605d76%2F%7B218DFB98-4FA8-49E4-870E-3E1BD7F2B23A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Erhalt eines **Geschenkkartencode** (Beispiel: `DbWseYFi2v`)

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bf544400cbdd52f0edd21528a147adf250381bd9%2F%7B05028327-3014-4261-AC5C-87AE4946C996%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-15228b23eb9e8d5f47d4f9499c64b44caf503f82%2F%7B2922EBC9-E4DA-4AFA-BF5C-77AFE41E241B%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Wenn dieser Code im Bereich für Geschenkkarten verwendet wird, erhöht sich das Kontoguthaben um **10$** während nur **7$** ausgegeben wurde.

Der Nettogewinn beträgt also **$3**, wodurch sich das gesamte Guthaben auf **$103**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5cfa35b4bf87c872cc9d6bb96abafaa4fb2c80cd%2F%7B5F7BEF80-054D-4C94-8965-2D2DDB5EB7D4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Festgestellte Logikfehler

1. Der Coupon kann **mehrmals** zum Kauf von Geschenkkarten verwendet werden.
2. Guthaben für Geschenkkarten wird **weiterhin zum vollen Wert angerechnet**, unabhängig vom tatsächlich bezahlten Preis.
3. Bestellbestätigung über den Endpunkt:

   ```bash
   /cart/order-confirmation?order-confirmed=true
   ```

ermöglicht die dynamische Ermittlung des Geschenkkartencodes.

Keine Einschränkung verhindert die Automatisierung dieses Prozesses.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-55e2eabaee74030c602861c50f46a4dd23222418%2F%7B9C7CB844-596C-4813-8814-5CD251A30BE7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Angriffsautomatisierung (Makro)

Um den groß angelegten Fehler auszunutzen, wird ein **Burp-Suite-Makro** implementiert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-27e5c0020d46100245515c8757fda9e0d537b793%2F%7BC0FB1618-3BD6-4892-8DD0-09C160A6911E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Im Makro abgefangene Anfragen

1. Ein Produkt hinzufügen **Geschenkkarte** zum Warenkorb
2. Anwendung des Newsletter-Coupons (`SIGNUP30`)
3. Bestellvalidierung (`Bestellung aufgeben`)
4. Abruf der Antwort der Bestellbestätigung
5. Registrierung der Geschenkkarte auf dem Benutzerkonto

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0c7ded1307665efdedff408fffc7c0c44263d3e5%2F%7BA0690E08-23D1-409E-85CF-82E673868463%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Wichtige Punkte des Makros

* Das **Geschenkkartencode** wird dynamisch aus der `Warenkorb-/Bestellbestätigungs` Antwort extrahiert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-322587d183fd337eacf0b571ecefa119f9f85dde%2F%7B509B7CC2-BE19-44A3-9990-84933C1553E9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Dieser Code wird dann per POST-Anfrage an den Endpunkt zur Verwaltung von Geschenkkarten erneut eingespeist.
* Ein benutzerdefiniertes **Parameters** wird in der GET-Abfrage gesetzt, um den Codewert zu speichern.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9bca90655a458d0f44ef9b653d82e1eea128ff43%2F%7B147C5FCB-AA53-4DDF-8B09-ADE105FABEF6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Der angewendete Coupon ruft seinen Wert aus einer vorherigen Abfrage ab, was eine automatische Wiederverwendung ermöglicht.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9c9764756e9d9cfb63a9a9054dad2bc4e8068a43%2F%7B0B3C9369-8100-4A35-AF59-3DB19D928851%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Massenausführung

Sobald das Makro konfiguriert ist:

Alle Anfragen für den **URL-Bereich** lösen das Makro automatisch aus.

* A **Intruder** Anfrage wird an das Stammverzeichnis der Website gesendet.
* Konfiguration:
* **500 Anfragen**
* **Nutzlast null**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6faa199c2f98a292c939ce81df7669a9096245f4%2F%7BFB2280E9-9ABE-4875-93B2-CBD08DCB4B7B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Ressourcenpool** begrenzt auf **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-8c20676ac7b015e7dae383d1e5a649146196c9f0%2F%7B7B673C75-A05B-4061-8C29-80E55C2DBF87%7D.png?alt=media" alt="" width="364"><figcaption></figcaption></figure>

Dieser Ansatz macht es möglich, Käufe, Bestätigungen und Guthaben von Geschenkkarten ohne Unterbrechung zu verketten.

#### Ergebnis

Das Kontoguthaben steigt unbegrenzt. / Sobald genügend Guthaben angesammelt ist, wird der Kauf der **Lightweight l33t Lederjacke** ohne finanzielle Einschränkung möglich.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e6e2cd1996c83495734638cd08179a54e2a5cbf5%2F%7B9EBF5FDD-31DC-41F4-9B62-DC0272D14FDD%7D.png?alt=media" alt="" width="375"><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/de/web/business-logic/logical-flaw-allowing-you-to-generate-infinite-money.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.
