> For the complete documentation index, see [llms.txt](https://notes.dollarboysushil.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.dollarboysushil.com/web-application-pentest/bugforge/business-logic-flaw/cheesy-does-it-forgot_password-flaw.md).

# Cheesy Does It  (forgot\_password flaw)

Level: Easy\
Points: 10\
Type: Daily Challenge

During register/login we can see forgot password feature.

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

Forgot-password takes only one arguement i.e `username` , we can pass any username here.

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

Once username is passed, OTP is sent to account's email address. The ui doesnot takes the value more than 4 digit.\
Meaning we can try to bruteforce the OTP.

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

There is no any rate limiting system and we can successfully bruteforce the OTP.\
After successfull OTP bruteforce, we get the reset\_token

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

From the js file,we can get idea on how to use the reset\_token to change the password.

POST request to /api/verify-token with values of&#x20;

* `username`&#x20;
* `reset_token`&#x20;
* `new_password`

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

Password successfully changed.

Now, we can login as admin and get the flag.

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