> 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/bypassing-access-controls-by-inconsistent-parsing-of-email-addresses.md).

# Umgehung von Zugriffskontrollen durch inkonsistente Verarbeitung von E-Mail-Adressen

Notizen zur Umgehung von Zugriffskontrollen durch inkonsistente Verarbeitung von E-Mail-Adressen für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Beh

### Umgehung von Zugriffskontrollen mithilfe von Unterschieden bei der E-Mail-Adressanalyse

#### Laborbeschreibung

Dieses Labor implementiert eine Validierung von E-Mail-Adressen, um Registrierungen mit nicht autorisierten Domains zu verhindern. / Allerdings gibt es eine Inkonsistenz zwischen der Validierungslogik auf Anwendungsseite und der Bibliothek, die tatsächlich zum Interpretieren von E-Mail-Adressen verwendet wird.

Mithilfe dieses Unterschieds in der Analyse ist es möglich, sich mit einer externen E-Mail-Adresse anzumelden und dabei die Beschränkung auf die autorisierte Domain zu umgehen, anschließend auf Admin-Funktionen zuzugreifen und den Benutzer zu löschen **carlos**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3c7e44c81befe43f141086d89a169934854990f0%2F%7BA30B519C-BDA0-4443-9FDD-5282BFBEA35E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Registrierungsbeschränkung

Beim Versuch, sich mit einer klassischen Adresse wie der folgenden zu registrieren:

```
test@jord4n.pro
```

Die Anwendung verweigert die Registrierung und gibt an, dass nur Adressen erlaubt sind, die zu folgender Domain gehören:

```
ginandjuice.shop
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-027e5e6211f0bddfa97b4f8b4abcc9b0bc1d4a6e%2F%7BA5BD5BEB-EF19-4914-93F5-E61D00C9502C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Eine legitime Registrierung mit dieser Domain löst dann eine Bestätigungs-E-Mail aus:

```
Bitte prüfen Sie Ihre E-Mails auf Ihren Link zur Kontoregistrierung
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ef2d6fec79a071ddc7b045f2307f3dbb45a70d1e%2F%7B60489A7B-5F54-45E9-A387-952C9FE53DB8%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Es ist daher notwendig, diese E-Mail zu empfangen, um die Registrierung abzuschließen.

#### Ursprung der Schwachstelle

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

Der Fehler beruht auf der Verwendung eines **Encoded-word** (RFC 2047), dessen Format wie folgt aussieht:

```bash
=?<charset>?<encoding>?<encoded-text>?=
```

Dieser Mechanismus ermöglicht die Kodierung bestimmter Teile einer E-Mail-Adresse.

Der Validierer der Anwendung lehnt einige Kodierungen ab, während der endgültige E-Mail-Parser sie korrekt interpretiert.

#### Erster Block

Ein einfacher Kodierungsversuch in UTF-8 (Quoted-Printable) wird von der WAF blockiert:

```bash
=?utf-8?q?=61=62=63?=@ginandjuice.shop
```

Antwort

```bash
Registrierung aus Sicherheitsgründen blockiert
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8fa2e9cab5503a47efeb6d69465c55152f18d171%2F%7B325666A1-4BCE-4A2E-9FE4-FB626AD43AE9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Umgehungstechnik

Um diese Filterung zu umgehen, **UTF-7-Kodierung mit Base64** verwendet.

Prinzip:

* Kodieren Sie ein Zeichen in UTF-16

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c6dcfd3f23f4442c24715358e30cacd0d9fabee2%2F%7B6A6E4381-B010-4CA5-AC1A-F12DA40DA498%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Konvertieren Sie dieses Ergebnis in Base64

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f372cb54f866c134e23c1ae203bb82d15a720432%2F%7BAF647B10-FDF7-4366-A51A-81F8C1C9BA3A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* In einem Encoded-Word UTF-7 verwenden

Beispiel für Zeichenkodierung `eine`:

* UTF-16 → Base64 : `AGE=`

Minimale funktionierende Nutzlast:

```bash
=?utf-7?&AGE-=?=@ginandjuice.shop
```

Dieser Wert wird von der Validierungslogik akzeptiert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-b7863f9b2d3bc553f2f4b30b2920955bda491dad%2F%7B39966655-6720-4B2A-81DA-139FCC8A9824%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Vollständige Ausführung mit einer kontrollierten Adresse

Angreiferadresse:

```bash
attacker@exploit-0ad8006c04c7300d8050fcb8013600a0.exploit-server.net
```

Aufbau der Nutzlast:

* `&AEA-` steht für `@`
* `&ACA-` steht für ein Leerzeichen und verhindert eine strikte Interpretation der endgültigen Domain

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6d15dd92299198ddd3da2de69fb2419d4334a670%2F%7B5B9D15F5-8F74-45F9-B06F-B4482B9CD336%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Beim Registrieren verwendete endgültige Nutzlast:

<pre class="language-bash" data-overflow="wrap"><code class="lang-bash"><strong>=?utf-7?q?jordan&#x26;AEA-exploit-0ad8006c04c7300d8050fcb8013600a0.exploit-server.net&#x26;ACA-?=@ginandjuice.shop
</strong></code></pre>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-43f4da9b3e2a5d2c4ea396e17515b265aaabefd2%2F%7BCE5D56A6-DCDF-48F9-A659-2663DA9DAD33%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

Von dem E-Mail-Server tatsächlich interpretierte Adresse:

```bash
jordan@exploit-0ad8006c04c7300d8050fcb8013600a0.exploit-server.net @ginandjuice.shop
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9d763ece6d2affda0def05154022315550977b56%2F%7BDF3E8F90-B1D8-4847-8AAD-CE383A0B9E27%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Ergebnis

* Die Anwendung validiert die Adresse, weil sie endet mit `@ginandjuice.shop`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-59dd4ee3c7dca7babb0d3630d132a1521a14ee8a%2F%7B5F863F7F-DE66-4C63-B07F-D8DEDD642BEA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Der E-Mail-Server sendet die E-Mail an die vom Angreifer kontrollierte Adresse
* Bestätigungslink empfangen
* Registrierung erfolgreich abgeschlossen
* Zugriff auf die Anwendung wird erlangt
* Administrative Aktionen werden möglich, einschließlich des Löschens des Benutzers **carlos**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-807a4c6e6b4171cd05c3be4aa9db39cb3f7659ab%2F%7B0F9E86D6-7510-45AB-A85D-39F085EA0BB1%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/business-logic/bypassing-access-controls-by-inconsistent-parsing-of-email-addresses.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.
