Skip to content
Account takeover Write-up Intermediate

P2 Password Reset Token Not Invalidated After Successful Password Change

The password reset token may not be invalidated after a successful password change, allowing an attacker who possesses the token to reuse it for additional password changes. This could lead to account compromise and loss of control for the legitimate user.

Akash motkar Follow

Published on medium.com

Bug Bounty

Akash motkar, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

The subject here is the password recovery and reset functionality of a web application, specifically the API endpoint that consumes a password-reset token and sets a new password. A reset token is meant to be a temporary, single-use credential that authorises exactly one password-reset operation. Once the password has been changed, the token should immediately become invalid.

The claim in this write-up is that the application may fail to invalidate the token after it has been successfully used. If the application continues to accept a previously consumed token, an attacker who obtains that token may be able to reuse it to perform additional password changes. The author classifies this as an authentication weakness and improper session and token management, mapping it to CWE-613 (Insufficient Session Expiration), CWE-640 (Weak Password Recovery Mechanism for Forgotten Password) and CWE-287 (Improper Authentication), and to OWASP A07:2025, Authentication Failures.

The report is explicit that the finding is illustrative and requires validation: the steps describe how to test the behaviour, and the severity of P2 (High) is stated as subject to validation. The issue becomes particularly serious when reset tokens remain valid for an extended period or are not invalidated after successful password changes.

Setup

The prerequisites listed are modest:

  1. Two controlled test accounts, or one account with a repeatable password-reset workflow.
  2. Access to the associated test email inbox, to retrieve the reset token.
  3. Burp Suite, to intercept and replay the reset request.

The affected component is the password recovery / reset functionality, reached over the network with the HTTP POST method. The only privilege required is possession of a valid password-reset token; no other authentication is described. The report does not name the target application, host, or any version numbers.

Finding it

The reasoning starts from what a reset token is supposed to be: a temporary, single-use credential. The author's concern is that the application may validate a token's authenticity and expiration without tracking whether the token has already been consumed. That gap is what makes replay worth testing: if the server checks only that the token is genuine and unexpired, a token that has already been used to change the password will still pass validation.

The write-up does not describe a specific observation in a live application that prompted the test. It presents the behaviour as something to verify, and the reproduction steps are written to answer one question: does the server accept a consumed token and actually apply a second password change?

Exploitation

Step 1: Request a password reset

Navigate to the application's password recovery page and request a reset link for a controlled test account. Retrieve the reset token from the email received.

Step 2: Intercept the password reset request

Open the reset link and intercept the corresponding request using Burp Suite. The example request is:

HTTP
POST /api/v1/auth/reset-password HTTP/1.1Host: <application-host>Content-Type: application/json

The request targets the reset-password API path with a JSON body. The body carries the token from the email and the new password:

JSON
{  "token": "<RESET_TOKEN>",  "new_password": "TestPassword@123"}

token is the value taken from the reset email; new_password is the password to set on the controlled account.

Step 3: Complete the password reset

Forward the request and confirm that the application successfully changes the account password. Record the response and retain the original reset token for testing. Keeping the token is the whole point: it is the artefact that will be replayed.

Step 4: Replay the consumed reset token

Send the same reset request again, using the previously consumed token but a different test password:

JSON
{  "token": "<PREVIOUSLY_USED_RESET_TOKEN>",  "new_password": "AnotherTestPassword@456"}

The token is the one already spent in Step 3, and the password value is different.

Step 5: Analyse the server response

Observe whether the application accepts the previously consumed token and returns a successful response. A success response to the replay is a signal worth following up, but the report stresses that the second password change must be demonstrated.

Step 6: Verify the behaviour

Using the controlled test account, verify whether the second password change actually occurred. The author is explicit that a successful HTTP response alone is insufficient to confirm the vulnerability: the second password change must be demonstrated, for example by logging in with the second password.

Root cause

The likely root cause is inadequate lifecycle management of password-reset tokens. The application may validate token authenticity and expiration without tracking whether the token has already been consumed. A secure implementation must enforce single-use token semantics and invalidate the token atomically when the password-reset operation succeeds.

The likely gap is that validity and consumption are treated as separate concerns, so a token that is still genuine and unexpired may pass validation even after it has served its purpose.

Impact

The report lists four consequences, all conditional on the token being reusable:

  • Unauthorized password modification: a previously consumed reset token may remain usable for additional password changes.
  • Account compromise: an attacker possessing a valid reset token may be able to repeatedly modify the account password.
  • Persistence of unauthorized access: if the token remains valid after the legitimate user resets their password, the attacker may retain a password-reset capability.
  • Loss of account control: the legitimate account owner may lose control over their account if an attacker successfully reuses the token.

The precondition throughout is that the attacker has obtained the token in the first place.

Fix

The remediation section gives nine measures:

  1. Enforce single-use password-reset tokens.
  2. Invalidate the reset token immediately after a successful password change.
  3. Store token consumption state server-side.
  4. Use cryptographically secure, unpredictable reset tokens.
  5. Enforce short token expiration periods.
  6. Invalidate outstanding reset tokens when a password is changed.
  7. Ensure token validation and consumption occur atomically to prevent replay and race conditions.
  8. Notify the account owner after a successful password change.
  9. Log password-reset activity and monitor suspicious repeated attempts.

Variants to test

  • Replay after a delay: wait before resending the consumed token. A positive result is a successful response and a confirmed second password change, showing the token survives beyond the immediate request.
  • Replay after the legitimate user resets again: have the account owner perform a fresh reset, then replay the old token. A positive result is that the old token still changes the password, which is the persistence scenario described in the impact section.
  • Concurrent use of one token: send two reset requests with the same token at the same time. A positive result is both succeeding, which points to a race in validation and consumption rather than a simple missing invalidation.
  • Token reuse across sessions or devices: use the token from a different client than the one that requested the reset. A positive result is acceptance, showing the token is not bound to the requesting context.
  • Other single-use tokens: apply the same replay test to email-verification links, invitation tokens and magic-login links. A positive result is any of them being accepted a second time after successful use.

In every variant, confirm the effect on the account itself, not just the HTTP status: the report is clear that a successful response alone does not prove the vulnerability.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

This write-up is about a common feature on almost every website: the "forgot password" button. When you click it, the site emails you a link. That link contains a long random string called a token. You click the link, type a new password, and the site changes it for you.

The token is supposed to work exactly once. Think of it like a single-use ticket at a train station barrier: you put it in, the gate opens, and the ticket is swallowed. You cannot use the same ticket to open the gate again. The author of this report is asking a simple question: after the ticket has been used, does the gate still open if you push the same ticket through a second time?

If the answer is yes, that is a security problem. Anyone who gets hold of that used token (from an old email, a shared computer, a leaked inbox, a backup) could change the password again, even after the real owner has already set a new one. The author calls this an authentication weakness and improper token management, and maps it to three well-known weakness categories (CWE-613, CWE-640, CWE-287) and to the OWASP Top 10 entry A07:2025, Authentication Failures. Those are just standard catalogues that security people use to label bugs consistently.

The report is honest about its status: it is illustrative and requires validation. In other words, the author is describing how to test the behaviour, not claiming a confirmed hit on a named target. The severity is listed as P2 (High), but explicitly "subject to validation". The report does not name the application, the host, or any version numbers.

The pieces you need to understand first

Before walking through the steps, here are the concepts that appear in them, explained from zero.

  • A web application is a program you use through a browser. You type a web address, the browser asks a server for a page, and the server sends it back. Everything you click happens through requests the browser sends to that server.
  • An API (Application Programming Interface) is the part of a website that talks to programs rather than to people. When you fill in a form in your browser, the browser often sends the data to an API behind the scenes. The API is like the counter at a post office: you hand over a form, the clerk processes it, and hands back a receipt. You do not see the clerk's desk, only the counter.
  • An HTTP request is the message your browser sends to a server. It has a method (a verb saying what you want to do, such as GET to read something or POST to send data), a path (which part of the site you are talking to), headers (extra labels, such as what format the data is in), and often a body (the actual data).
  • JSON is a simple text format for structured data. It looks like { "name": "value" }. Servers and browsers use it to exchange information because it is easy for both humans and machines to read.
  • A password-reset token is a long random string that the site generates when you ask to reset your password. It is put inside the reset link in the email. When you click the link, the site reads the token and checks: is this genuine, and has it expired? If yes, it lets you set a new password. The token is meant to be single-use: once it has done its job, it should be dead.
  • Burp Suite is a tool used by security testers. It sits between your browser and the server and lets you see, pause, edit and resend the requests your browser makes. Think of it as a transparent envelope you can slip over the postal system: you can read every letter, hold one back, change its contents, and post it again.
  • Replay means sending the same request again, unchanged or with small edits, to see whether the server treats it as new. If a server accepts a replayed request that should only ever work once, that is a replay problem.
  • A race condition is what happens when two things happen at almost the same moment and the system is not prepared for it. Like two people grabbing the last seat on a train at the same instant: both think they got it, and the system has to decide who really did.

Setup

The report lists three prerequisites, and they are modest:

  1. Two controlled test accounts, or one account with a repeatable password-reset workflow. You need an account you own and are allowed to experiment on.
  2. Access to the associated test email inbox, so you can retrieve the reset token from the email.
  3. Burp Suite, to intercept and replay the reset request.

The affected component is the password recovery and reset functionality, reached over the network with the HTTP POST method. The only privilege required is possession of a valid password-reset token; no other authentication is described.

Finding it

The reasoning starts from what a reset token is supposed to be: a temporary, single-use credential. The author's concern is that the application may check two things about a token, that it is genuine and that it has not expired, but not a third thing: whether it has already been used. That gap is what makes replay worth testing. If the server checks only authenticity and expiry, a token that has already changed the password once will still pass the check a second time.

The write-up does not describe a specific observation in a live application that prompted the test. It presents the behaviour as something to verify, and the reproduction steps are written to answer one question: does the server accept a consumed token and actually apply a second password change?

Exploitation

Step 1: Request a password reset

Navigate to the application's password recovery page and request a reset link for a controlled test account. Retrieve the reset token from the email received.

Why this step: you need a real token to test with, and you need to be the one who requested it so you know exactly where it came from and what it is tied to.

Step 2: Intercept the password reset request

Open the reset link and intercept the corresponding request using Burp Suite. The example request is:

HTTP
POST /api/v1/auth/reset-password HTTP/1.1Host: <application-host>Content-Type: application/json

Line by line:

  • POST /api/v1/auth/reset-password HTTP/1.1 is the request line. POST is the method, meaning "I am sending data for you to act on". /api/v1/auth/reset-password is the path, the address of the specific function on the server that handles password resets. HTTP/1.1 is the version of the protocol being used.
  • Host: <application-host> tells the server which site the request is for.
  • Content-Type: application/json tells the server that the body of the request is in JSON format, so it knows how to read it.

The body carries the token from the email and the new password:

JSON
{  "token": "<RESET_TOKEN>",  "new_password": "TestPassword@123"}

Line by line:

  • { and } mark the start and end of a JSON object, which is a collection of named values.
  • "token": "<RESET_TOKEN>" is one named value. The name is token, and the value is the placeholder <RESET_TOKEN>, which in a real test would be the long random string from the reset email.
  • "new_password": "TestPassword@123" is the second named value. The name is new_password, and the value is the password you want to set on the controlled account. TestPassword@123 is just an example value used in the report.

Why this step: you want to see and control the exact request the browser sends, so that later you can send it again yourself. Without Burp Suite, the browser would send it once and you would have no easy way to repeat it.

Step 3: Complete the password reset

Forward the request and confirm that the application successfully changes the account password. Record the response and retain the original reset token for testing.

Why this step: this is the legitimate use of the token. You are spending the ticket. Keeping the token afterwards is the whole point: it is the artefact that will be replayed. If you throw it away, there is nothing to test.

Step 4: Replay the consumed reset token

Send the same reset request again, using the previously consumed token but a different test password:

JSON
{  "token": "<PREVIOUSLY_USED_RESET_TOKEN>",  "new_password": "AnotherTestPassword@456"}

Line by line:

  • "token": "<PREVIOUSLY_USED_RESET_TOKEN>" is the same token value from Step 3. The placeholder name has changed to make clear it is the one already spent.
  • "new_password": "AnotherTestPassword@456" is a different password from the first one. Using a different value makes it easy to tell later which password actually took effect.

Why this step: this is the actual test. If the server accepts this request, the token was not invalidated when it was used. If the server rejects it, the token was properly single-use.

Step 5: Analyse the server response

Observe whether the application accepts the previously consumed token and returns a successful response. A success response to the replay is the first clue that the token may not have been invalidated on use.

Why this step: the server's answer is the first clue. A success message means the server did not refuse the replay. But a success message alone is not proof, which is why there is a Step 6.

Step 6: Verify the behaviour

Using the controlled test account, verify whether the second password change actually occurred. The author is explicit that a successful HTTP response alone is insufficient to confirm the vulnerability: the second password change must be demonstrated, for example by logging in with the second password.

Why this step: servers sometimes say "OK" without actually doing anything, or do something different from what they claim. The only way to know the password really changed is to try logging in with the new one. This is the difference between a promising signal and a confirmed finding.

Root cause

The likely root cause is inadequate lifecycle management of password-reset tokens. The application may validate token authenticity and expiration without tracking whether the token has already been consumed. A secure implementation must enforce single-use token semantics and invalidate the token atomically when the password-reset operation succeeds.

In plain words: the server checks that the ticket is real and not out of date, but it does not keep a list of tickets already used. The likely gap is that validity and consumption are treated as separate concerns, so a token that is still genuine and unexpired may pass validation even after it has served its purpose.

Impact

The report lists four consequences, all conditional on the token being reusable:

  • Unauthorized password modification: a previously consumed reset token may remain usable for additional password changes.
  • Account compromise: an attacker possessing a valid reset token may be able to repeatedly modify the account password.
  • Persistence of unauthorized access: if the token remains valid after the legitimate user resets their password, the attacker may retain a password-reset capability.
  • Loss of account control: the legitimate account owner may lose control over their account if an attacker successfully reuses the token.

The precondition throughout is that the attacker has obtained the token in the first place.

Fix

The remediation section gives nine measures:

  1. Enforce single-use password-reset tokens.
  2. Invalidate the reset token immediately after a successful password change.
  3. Store token consumption state server-side.
  4. Use cryptographically secure, unpredictable reset tokens.
  5. Enforce short token expiration periods.
  6. Invalidate outstanding reset tokens when a password is changed.
  7. Ensure token validation and consumption occur atomically to prevent replay and race conditions.
  8. Notify the account owner after a successful password change.
  9. Log password-reset activity and monitor suspicious repeated attempts.

Variants to test

  • Replay after a delay: wait before resending the consumed token. A positive result is a successful response and a confirmed second password change, showing the token survives beyond the immediate request.
  • Replay after the legitimate user resets again: have the account owner perform a fresh reset, then replay the old token. A positive result is that the old token still changes the password, which is the persistence scenario described in the impact section.
  • Concurrent use of one token: send two reset requests with the same token at the same time. A positive result is both succeeding, which points to a race in validation and consumption rather than a simple missing invalidation.
  • Token reuse across sessions or devices: use the token from a different client than the one that requested the reset. A positive result is acceptance, showing the token is not bound to the requesting context.
  • Other single-use tokens: apply the same replay test to email-verification links, invitation tokens and magic-login links. A positive result is any of them being accepted a second time after successful use.

In every variant, confirm the effect on the account itself, not just the HTTP status: the report is clear that a successful response alone does not prove the vulnerability.

Glossary

  • API: the part of a website that programs talk to, rather than people; it receives requests and sends back data.
  • Authentication: the process of proving who you are, usually with a username and password.
  • Authentication weakness: a flaw in how a system proves identity or manages the credentials involved.
  • Burp Suite: a tool that sits between your browser and a server so you can see, pause, edit and resend requests.
  • CWE: Common Weakness Enumeration, a public catalogue of standard labels for types of software weakness.
  • CWE-287: Improper Authentication, a category for flaws where the system does not properly verify identity.
  • CWE-613: Insufficient Session Expiration, a category for flaws where credentials or sessions stay valid longer than they should.
  • CWE-640: Weak Password Recovery Mechanism for Forgotten Password, a category for flaws in the forgot-password process.
  • HTTP request: the message a browser or tool sends to a server, containing a method, a path, headers and often a body.
  • HTTP method: the verb in a request, such as GET to read or POST to send data.
  • Header: an extra label in a request or response, such as the format of the data being sent.
  • JSON: a simple text format for structured data, written as named values inside curly braces.
  • OWASP: Open Worldwide Application Security Project, a community that publishes widely used security guidance, including the Top 10 list.
  • OWASP A07:2025: the Authentication Failures entry in the OWASP Top 10 list for 2025.
  • Password-reset token: a long random string sent in a reset email that authorises one password change.
  • P2: a priority or severity label meaning high, in the ranking used by this report.
  • Race condition: a problem that occurs when two actions happen at almost the same moment and the system is not prepared to handle both correctly.
  • Replay: sending the same request again to see whether the server accepts it a second time when it should not.
  • Single-use: designed to work exactly once and then become invalid.
  • Token: a piece of data, usually a long random string, that acts as proof of permission or identity.
  • Token lifecycle management: keeping track of a token from creation to expiry, including whether it has already been used.
  • Validation: checking that something is genuine and allowed, such as confirming a token is real and unexpired.

More by Akash motkar

View all

3 more disclosed reports, best first.

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.