> 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/race-conditions/race-conditions-that-bypass-limits.md).

# Race Conditions, die Begrenzungen umgehen

Notizen zu Race Conditions, die Begrenzungen umgehen, für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Kontext zur Behebung.

### Rennbedingungen bei Grenzwertüberschreitung

Der Kauf-Stream enthält eine **Rennbedingung** die es dir ermöglicht, einen **unerwarteten Preis** zum Zeitpunkt der Zahlung zu erhalten.

#### Ziel

Kaufe erfolgreich die **Leichte L33t-Lederjacke**.

#### Daten / Voraussetzungen

* Anmeldedaten: `wiener:peter`
* Rabattcode (20 %): `PROMO20`
* Verfügbares Guthaben: **$50**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ece9370cb2bdf79fababb3fc8b1d2f0722dd6d2%2F%7B944C81AC-4354-4BC2-8DE1-F965C756CC1A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Kosten der Jacke: **$1300**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1ecb32fb317fcf10e235a2128b20fb9da81c1978%2F%7BE59C4756-54D8-443B-A799-75A464062A67%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Verhaltensbeobachtung

1. Lege die Jacke in den Warenkorb.
2. Wende den `PROMO20` Coupon an.
3. Wenn du versuchst, den Coupon ein zweites Mal anzuwenden, antwortet die Anwendung: **Coupon bereits angewendet**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-46405c4b9854c6996abcf9adb4bdf076da7f1597%2F%7BF3777B3E-48EE-4557-B9BC-429A5151C008%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Die Anfrage zum Anwenden des Coupons sieht so aus (Formular-URL-kodiert):

```bash
csrf=7QYFGBaACc8P5YOfUHR4S85oo95uA0Vb&coupon=PROMO20
```

### Manuelle Ausnutzung (Burp Repeater)

1. Sende die Anwendungsanfrage an **Repeater**.
2. Erstellen Sie eine **Gruppe** in Repeater.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c5f75c5fc6d82386e6bbbf1eb44f3843b38d9a0e%2F%7B7930725F-7452-4FEB-9AE5-5A3B6689234F%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

* Dupliziere den Anfrage-Tab /\~20-mal (**Tab duplizieren**).

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8922ebbefcbb65751bccbd3b31cae3edc7946042%2F%7B584C98C5-87B5-4093-BA1A-FDFF28468AC2%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-8844568de87af86ef85247fe800333c30c28ca03%2F%7B5D6306B5-1BEB-4008-BB05-D50E1309FFB1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Anfragen senden **parallel**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-73f329e096684bf1d66b78855deaaeb158b89d87%2F%7BE6CDA436-5E4B-491A-ACA0-74973BB14353%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Das Ergebnis ist, dass die meisten Anfragen **validiert** werden, und die Gesamtsumme wird **/\~37**, was dir den Kauf trotz des ursprünglichen Preises (1300 $) und des begrenzten Guthabens ermöglicht.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bec1d11878b2c95d4318eec35e1b4c591ae6461f%2F%7BBF3732E3-06D8-4A81-B5B6-2190386B9AC9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### Automatisierte Ausnutzung (Benutzerdefinierte Aktion in Burp Suite Pro)

Das Lab empfiehlt die Verwendung von **Rennbedingungen auslösen** (Burp Suite Professional) über eine **Benutzerdefinierte Aktion**.

#### 1) Skript hinzufügen (Bambda-Bibliothek)

Gehe zu **Erweiterungen → Bambda-Bibliothek** und füge hinzu:

* **ID**: `eb57d5bd-33e2-4a8c-bf51-bc81bd26613a`
* **name**: `Auf Rennbedingung prüfen`
* **Funktion**: `CUSTOM_ACTION`
* **Ort**: `REPEATER`

```javascript
id: eb57d5bd-33e2-4a8c-bf51-bc81bd26613a
name: Auf Rennbedingung prüfen
function: CUSTOM_ACTION
location: REPEATER
source: |+
  /**
  * Wiederholt die Anfrage 10-mal, um Rennbedingungen oder Request-Smuggling auszulösen, wobei der Single-Packet-Angriff für HTTP/2 und die Last-Byte-Synchronisation für HTTP/1 verwendet wird
  *
  * @author James Kettle
  **/
  int NUMBER_OF_REQUESTS = 10;
  var reqs = new ArrayList<HttpRequest>();
  for (int i = 0; i < NUMBER_OF_REQUESTS; i++) {
      reqs.add(requestResponse.request());
  }

  var responses = api().http().sendRequests(reqs);
  var codes = responses.stream().map(HttpRequestResponse::response).map(HttpResponse::statusCode).toList();
  logging().logToOutput(codes);
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-74efc545ee462780971b4d839986b812e11b584b%2F%7B69D346CD-E49B-46B1-8F5F-11E850ED3E03%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2) Von Repeater aus starten

1. In Repeater: **Benutzerdefinierte Aktion** → aus Beispielen hinzufügen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ea08324571f36fe57d59d511920f146ea06edb4b%2F%7B668FF286-DE9E-4B8E-BAFC-3EDBE64C17AA%7D.png?alt=media" alt="" width="548"><figcaption></figcaption></figure>

* Benutzerdefinierte Aktion geladen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-aca5636ca6c2b8a5d09483aa20b52a1190edbe92%2F%7BC0F85A68-691D-45D2-B99A-C14886278A6A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Testen Sie mit **30 Anfragen**.

sehen wir **Statuscodes** (für 30 Sendungen) und wir können die Rennbedingung leichter auslösen

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e192221becf971242f3dc030aefede5444517248%2F%7B4BB4F25E-E949-44D6-9EE7-C487F778830E%7D.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/de/web/race-conditions/race-conditions-that-bypass-limits.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.
