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

# Elusión del inicio de sesión OAuth mediante el flujo implícito

### Omisión de autenticación mediante el flujo implícito de OAuth

#### Contexto del laboratorio

Este laboratorio usa un **OAuth** proveedor para permitir la conexión mediante una cuenta de una red social. / Debido a una insuficiente **validación en la aplicación cliente**, es posible conectarse a otra cuenta de usuario **sin conocer su contraseña**.

Objetivo: conectarse como **carlos** (correo electrónico: `carlos@carlos-montoya.net`). / Cuenta de red social disponible: `wiener:peter`.

#### Observaciones

* Al intentar iniciar sesión, la aplicación redirige a una página de OAuth:
  * *“Ahora lo estamos redirigiendo para iniciar sesión con redes sociales...”*

<figure><img src="/files/85d0220ad72dc333dd9cdf28cb8ff916b8b8ed3f" alt=""><figcaption></figcaption></figure>

* Después de la autenticación en el dominio de OAuth y la aceptación de permisos (perfil + correo electrónico), la aplicación envía entonces una solicitud a un endpoint interno, normalmente:
* `POST /authenticate`

<figure><img src="/files/758562514a58554c580aaa51b3256fc0a45c0493" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/192748b91fb56816924fb2bc5262a33d30b3087d" alt=""><figcaption></figcaption></figure>

* Esta solicitud contiene un JSON del tipo:

{% code overflow="wrap" %}

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

{% endcode %}

Punto clave: la aplicación **confía en** el `correo electrónico` y `username` los campos transmitidos por el cliente, en lugar de **estrictamente** vincular estos valores con `token`.

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

#### Explotación

1. Conéctese normalmente mediante OAuth con la cuenta **wiener**.
2. Intercepte la solicitud enviada a `POST /authenticate`.
3. Cambie solo los campos de identidad, manteniendo el mismo `token`:

<figure><img src="/files/408b4451fe1d03c04780d0f68be4b63a8c049e15" alt=""><figcaption></figcaption></figure>

4. Envíe la solicitud modificada.

#### Resultado

* El servidor responde **`302 Found`**, lo que indica que la sesión se ha creado y que la aplicación considera autenticado al usuario.
* Entonces obtenemos una sesión \*\* conectada como Carlos\*\*.

<figure><img src="/files/0dfcbd10790338ede646b8a4af9af01774d6a531" 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/es/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.
