> 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/single-endpoint-race-condition.md).

# Race Condition an einem einzelnen Endpunkt

Notizen zur Race Condition an einem einzelnen Endpunkt für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Kontext zur Behebung.

### Race Conditions mit einem einzelnen Endpunkt

### Laborkontext

Die Funktion zum Ändern der E-Mail-Adresse enthält eine **Race Condition** die es ermöglicht, eine beliebige Adresse mit unserem Konto zu verknüpfen.

Ein Benutzer mit der Adresse **<carlos@ginandjuice.shop>** hat eine **ausstehende Einladung** zum Administrator, aber **hat noch kein Konto erstellt**. / Wenn also jemand dazu kommt, **diese Adresse weiterzuverkaufen**, erhält er automatisch die **Administratorrechte**.

### Ziel

1. Finde eine Race Condition, um eine beliebige E-Mail-Adresse zu übernehmen.
2. Ändere die E-Mail des Kontos zu **<carlos@ginandjuice.shop>**.
3. Greife auf die **Admin-Panel**.
4. Benutzer löschen **carlos**.

Bereitgestellte Zugangsdaten: **wiener:peter**/ Zugriff auf einen E-Mail-Client für Adressen **@exploit-...exploit-server.net**.

### Normaler Ablauf zum Ändern der E-Mail-Adresse

Der erste Versuch besteht darin, die E-Mail-Adresse in eine kontrollierte Adresse zu ändern:

* Neue Adresse:/ `wiener@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3ab11eef8935b88b8cf12e18aa475fef81448792%2F%7BB9965F27-F99E-4E23-9E7D-9F2E94C7F043%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Antwort der Anwendung:

> „Bitte klicken Sie auf den Link in Ihrer E-Mail, um die Änderung der E-Mail-Adresse zu … zu bestätigen“

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6eba0920d90de61a9f7285b81f048bae6142d92f%2F%7BB366E8CE-D8D9-4D46-942E-63B9BB8FE44B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Eine E-Mail kommt mit einem Bestätigungslink, zum Beispiel:/ `/confirm-email?user=wiener&token=ob0dI7AMlwX2Y2uw`

Sobald der Link angeklickt wurde:

> „Ihre E-Mail wurde erfolgreich aktualisiert“

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9f60d6a8e3d68770dc60ff1e54f0ea08e8c3171e%2F%7B5AB7B670-A429-47DB-A72F-80B5111784B6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Im Hintergrund sieht die Anfrage so aus:

```bash
email=wiener%40exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk
```

### Grundtest ohne Race Condition

Wir senden mehrere Anfragen zum Ändern der E-Mail-Adresse mit unterschiedlichen E-Mails (test1, test2, ... test20), jeweils einzeln, und die erhaltenen Bestätigungen entsprechen korrekt den angeforderten Adressen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-357c60e05d8bfd2eb429eb50840b2067cb7c476e%2F%7BB58C2B7C-B60C-4F1F-829B-5096C98DAC0A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

```bash

email=test1@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test2@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test3@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test4@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test5@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test6@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test7@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk

email=test8@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk
.....

email=test20@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c43aa15adffcea353c6bb0c501b4dcb55f92773d%2F%7B9FCBD891-6314-4A27-BB9C-4E2E9E301C6F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Aber wenn Sie diese gleichen Anfragen ausführen **parallel**, tritt ein unerwartetes Verhalten auf: Sie erhalten manchmal Bestätigungen, die nicht zum richtigen Empfänger passen.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6b191058ec9bc145e37525859bbf436cd2afa1f7%2F%7BC1955487-7C79-46C5-AA7F-4E5AB76649ED%7D.png?alt=media" alt="" width="563"><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-3bf9ae1755022c015c658c9cbe8848492dbb8903%2Fimage%20(87).png?alt=media" alt=""><figcaption></figcaption></figure>

### Analyse der Race Condition

Das beobachtete Verhalten deutet auf eine Verarbeitung in zwei Phasen hin\*\*:

1. Eine Phase, die **vorbereitet/schreibt** Bestätigungs-E-Mail
2. Eine Phase, die **bestimmt, welche Adresse** die E-Mail gesendet wird

Durch das parallele Senden eines Stapels von Anfragen gelingt es uns, diese beiden Phasen zu überlappen: Der Inhalt einer E-Mail kann mit einer anderen Zieladresse verknüpft werden.

Prinzip: Sende parallel eine Mischung von Anfragen, die enthalten:

Teil mit:

```bash
email=carlos@ginandjuice.shop&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk
```

Ein anderer Teil mit einer kontrollierten Adresse:

```bash
email=test@exploit-0a10009b04efd21981a1bafc0102005d.exploit-server.net&csrf=UoUvroZsYvL6IJPN7GKumJSoEuLFdBYk
```

Ergebnis: Wir erhalten eine E-Mail mit dem Hinweis:

> „Um Ihre E-Mail-Änderung zu **<carlos@ginandjuice.shop>**, klicken Sie auf den untenstehenden Link“

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5907a4217989d1b6c48409ce59ae672be0456335%2F%7BF5E0B96B-0ACE-47EE-8C3F-E268A7538D29%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

So erhalten wir den **Bestätigungslink** für Carlos’ Adresse und können die Änderung der E-Mail abschließen zu **<carlos@ginandjuice.shop>**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-efdf8a609e605c94a029cf972ff85131bdfd9c4d%2F%7BA07FCA9E-56F0-4753-BA33-FF61670FA998%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/single-endpoint-race-condition.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.
