---
description: Buy Me Ko-fi! https://ko-fi.com/h0tak88r
---

# Unlocking the Weak Spot: Exploiting Insecure Password Reset Tokens

In our continuous efforts to enhance cybersecurity, we recently uncovered a significant vulnerability in the password reset functionality of a well-known corporation's private bug bounty program on [HackerOne](https://hackerone.com/v). This blog post details our journey from discovery to proof of concept, highlighting the critical importance of robust security measures in protecting user accounts.

#### The Discovery

During our routine security assessments, we stumbled upon a critical flaw in the password reset mechanism. The reset password token, a crucial element for securing the password recovery process, was being generated using a weak algorithm. This token comprised numbers and lowercase characters, making it susceptible to brute-force attacks. Furthermore, there was no rate limit on the password reset endpoint, amplifying the risk of unauthorized access.

<div align="center" data-full-width="true"><figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2FoRTazEGIHFUiiyWgybg6%2Fimage.png?alt=media&#x26;token=cc84caa1-6cec-40a0-999a-90cc4fc00a6e" alt=""><figcaption><p>Password Reset Workflow</p></figcaption></figure></div>

#### Understanding the Token Generation

To comprehend the token generation process, we first analyzed the structure of the reset password token. We discovered that:

* The first three digits of the token were fixed and always stored as `001` .
* The remaining eight characters consisted of numbers and lowercase letters.

This predictable pattern significantly reduced the complexity of the token, making it easier for an attacker to guess.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2F1nQJw2pZntQY5W2X77LC%2Fimage.png?alt=media&#x26;token=4fd9a418-47a4-42ce-90b7-ac029f328f55" alt=""><figcaption></figcaption></figure>

#### Steps to Reproduce

**Step 1: Initiate a Password Reset**

The first step involved requesting a password reset for a various target accounts to observe the structure of the reset password token. This allowed us to identify the fixed and variable parts of the token.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2Fisfa7Kltk4Af5blMDAev%2Fimage.png?alt=media&#x26;token=1625fb1b-758d-4568-ad16-b30eef24570a" alt=""><figcaption></figcaption></figure>

**Step 2: Brute-Force the Token**

Armed with this knowledge, we used Burp Suite, a popular web proxy, to brute-force the reset token. By using any invalid or old reset link we landed in a password reset page.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2F81Vy6KzSkCU4gLRlbfSg%2Fimage.png?alt=media&#x26;token=65121dd7-394d-4ad2-ac73-760586594337" alt=""><figcaption></figcaption></figure>

It takes parameters email, new password and password confirmation, Setting the email parameter to victim's email and filled the new password field then captured the request using burp suite i found there is parameter for token.,manually setting the first three digits to `001` and fuzzing the remaining characters, we were able to generate numerous token combinations rapidly.

To demonstrate the vulnerability, we used Intruder and crafted a Burp Suite request that bypassed the lack of rate limiting and successfully brute-forced the reset password token.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2F7VQMFTcy4hQ30R97kClZ%2Fimage.png?alt=media&#x26;token=f22ba244-d508-47ed-a932-e3f4110d9883" alt=""><figcaption></figcaption></figure>

We sent approximately 8,000 requests without encountering any rate limiting, ultimately succeeding in brute-forcing the token and resetting the password for the target account.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2FySnfJ6AZrxS9bjKEhOCN%2Fimage.png?alt=media&#x26;token=c1cab65f-2024-43d5-83c5-4df7c5210129" alt=""><figcaption></figcaption></figure>

#### Recommendations

To mitigate such vulnerabilities and enhance security, we recommend the following measures:

1. **Increase Token Complexity:** Adopt a more sophisticated token generation algorithm that includes uppercase letters, numbers, and special characters to increase the token's entropy and reduce predictability.
2. **Implement Rate Limiting:** Introduce rate limiting on the password reset endpoint to prevent brute-force attacks and limit the number of attempts an attacker can make.
3. **Monitor and Alert:** Set up robust monitoring and alerting mechanisms to detect unusual activity on the password reset endpoint and respond promptly to potential security threats.

#### Conclusion

Our discovery underscores the importance of rigorous security practices in safeguarding user accounts. By addressing these vulnerabilities proactively, organizations can protect their users from potential threats and maintain trust in their digital services. We urge all corporations to regularly review and enhance their security measures, particularly around critical functionalities like password resets.

Stay tuned for more insights from our ongoing security research and discoveries.

<figure><img src="https://2308035028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWeYzWCIl8fzqyot9mus5%2Fuploads%2FqswrwZw5bu31Pq7jRgD7%2Fimage.png?alt=media&#x26;token=1d32ec10-f922-4459-a607-4fefaab1c47a" alt=""><figcaption></figcaption></figure>
