> 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/oauth-authentication/oauth-login-bypass-via-implicit-flow.md).

# OAuth-Login-Umgehung über den impliziten Flow

### Authentifizierungsumgehung über den OAuth-Implicit-Flow

#### Laborkontext

Dieses Lab verwendet einen **OAuth** Anbieter, um die Anmeldung über ein Social-Media-Konto zu ermöglichen. / Aufgrund einer unzureichenden **Validierung in der Client-Anwendung**, ist es möglich, sich mit einem anderen Benutzerkonto zu verbinden **ohne sein Passwort zu kennen**.

Ziel: sich anzumelden als **carlos** (E-Mail: `carlos@carlos-montoya.net`). / Verfügbares Social-Media-Konto: `wiener:peter`.

#### Beobachtungen

* Beim Anmeldeversuch leitet die Anwendung zu einer OAuth-Seite weiter:
  * *„Wir leiten Sie jetzt zur Anmeldung über soziale Medien weiter...“*

<figure><img src="/files/679e5cf719ca7fa6886d6f2538841144ca023eb5" alt=""><figcaption></figcaption></figure>

* Nach der Authentifizierung auf der OAuth-Domain und der Annahme der Berechtigungen (Profil + E-Mail) sendet die Anwendung dann eine Anfrage an einen internen Endpunkt, typischerweise:
* `POST /authenticate`

<figure><img src="/files/18413df41363c1449185c9bb223ac3e417ed7ac5" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/34dda00126f620d2198a297b846a114491564117" alt=""><figcaption></figcaption></figure>

* Diese Anfrage enthält ein JSON der Art:

{% code overflow="wrap" %}

```json
{
"email":"wiener@hotdog.com",
"username":"wiener",
"token":"MkydN3cYAC6wsKXQJEd5tD3kW1nB9MoWqzdfhyL6BtE"
}
```

{% endcode %}

Wichtiger Punkt: Die Anwendung **vertraut** der `E-Mail` und `Benutzernamen` die vom Kunden übertragenen Felder, anstatt **streng** diese Werte zu verknüpfen mit `Token`.

```json
{
"email":"carlos@carlos-montoya.net",
"username":"carlos",
"token":"MkydN3cYAC6wsKXQJEd5tD3kW1nB9MoWqzdfhyL6BtE"
}
```

#### Ausnutzung

1. Normalerweise über OAuth mit dem Konto anmelden **wiener**.
2. Fange die an `POST /authenticate`.
3. Ändere nur die Identitätsfelder und behalte denselben `Token`:

<figure><img src="/files/0bb951563ee061f8a119096f0aaead37804317a7" alt=""><figcaption></figcaption></figure>

4. Sende die modifizierte Anfrage.

#### Ergebnis

* Der Server antwortet **`302 Found`**, was darauf hinweist, dass die Sitzung erstellt wurde und dass die Anwendung den Benutzer als authentifiziert betrachtet.
* Dann erhalten wir eine Sitzung \*\*, verbunden als Carlos\*\*.

<figure><img src="/files/c17e52106a6176ea1bdbe6df52610da1c64cf6ab" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/de/web/oauth-authentication/oauth-login-bypass-via-implicit-flow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
