Skip to content
Account takeover Write-up Beginner

How I Found a Way to Prolong Password Reset Code Expiry

The password reset code was reused on each request and its expiry timer was reset, so an attacker could keep the same 6-digit code valid for many hours. This extended the time available to brute-force the code and take over an account.

medium.com

Published on medium.com

Free Article Link: Click for free!

Ehtesham Ul Haq, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server reused the existing reset code instead of generating a new one and extended its expiry on each request.

Impact

An attacker could keep a 6-digit reset code alive for many hours, making brute-force guessing easier and potentially leading to account takeover.

What the attacker needed

A registered account; ability to receive the reset email; request made before code expires

The fix

Each password reset request should generate a new unique code and invalidate any previous codes.

How it was found

  1. Register an account and verify the email address.
  2. Request a password reset and note the 6-digit code and the time.
  3. Before the code expires, request another password reset.
  4. Observe that the same code arrives and its expiry is pushed forward by another hour.
  5. Repeat the request to extend the expiry further.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you forget your password, a website emails you a short number (a code) to prove it is you. That code is meant to stop working after an hour. Here, asking for a new code sent the same number again and restarted the one-hour clock, so someone guessing numbers had much more time to try them all.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.