> 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/authentication/flawed-password-reset-logic.md).

# Lógica defectuosa en el restablecimiento de contraseñas

### Lógica rota en el restablecimiento de contraseña

El laboratorio presenta una vulnerabilidad en el mecanismo de restablecimiento de contraseña. El objetivo es restablecer la contraseña de **Carlos** y luego acceder a su página Mi cuenta. / Identificador proporcionado:

* **wiener:peter**
* Nombre de la víctima: **carlos**

### Análisis y pasos

#### 1. Función de contraseña olvidada

La aplicación ofrece una función de recuperación mediante Olvidé mi contraseña.

<figure><img src="/files/fccfc39d51c54dc90e16aa8678e04258c4540611" alt="" width="436"><figcaption></figcaption></figure>

Desde esta sección es posible cambiar la dirección de correo asociada a la cuenta

<figure><img src="/files/f4974d0a479480b8aa1366b72fb97d60d4dba6bf" alt="" width="563"><figcaption></figcaption></figure>

#### 2. Recepción del correo de restablecimiento

<figure><img src="/files/6f3f99f5802ced0e187261fbfc26db3c760b5074" alt=""><figcaption></figcaption></figure>

Una vez cambiado el correo, se envía un mensaje que contiene un enlace de restablecimiento. / El correo incluye un token temporal **token** en la URL:

```http
Enviado:     2025-12-09 19:42:17 +0000
De:     "No reply" <no-reply@0ae200710383c04f868b0866005e0000.web-security-academy.net>
Para:       wiener@exploit-0a46000003d9c0a086ee072901710023.exploit-server.net
Asunto:  Recuperación de la cuenta

¡Hola!

Sigue el enlace de abajo para restablecer tu contraseña.

https://0ae200710383c04f868b0866005e0000.web-security-academy.net/forgot-password?temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj

Gracias,
Equipo de soporte
```

#### 3. Envío del formulario

Al acceder a este enlace, la aplicación solicita introducir una nueva contraseña. / Los parámetros enviados son similares a:

```bash
temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj
username=wiener
new-password-1=test
new-password-2=test
```

<figure><img src="/files/7aaaa35f9f7b106c04d98621156faf9c1c974d05" alt=""><figcaption></figcaption></figure>

#### 4. Explotación de la lógica defectuosa

El servidor no comprueba **no** que el token realmente coincida con el usuario mencionado en la consulta. / Simplemente reemplaza el campo **username=wiener** por **username=carlos**:

```bash
temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj
username=carlos
new-password-1=test
new-password-2=test
```

La aplicación acepta la solicitud, lo que permite establecer una nueva contraseña para Carlos.

<figure><img src="/files/118f7e0fa6ef7624d7f756faf11189a437d23279" 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/authentication/flawed-password-reset-logic.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.
