Insecure Password Reset Mechanism

The password reset process can be abused to take over other users' accounts, for example through guessable, reusable or misdirected reset tokens.

SeverityHigh
CVSS 3.17.4 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N Open in the calculator
CVSS 4.09.1 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-640: Weak Password Recovery Mechanism for Forgotten Password
OWASP Top 10A07:2025 Authentication Failures
MITRE ATT&CKT1212 Exploitation for Credential Access, T1078 Valid Accounts
CategoryInsecure Design

Description

The forgotten password or account recovery process does not reliably prove that the person resetting a password controls the account's registered email address or phone number. Because a reset replaces the password without knowledge of the old one, a weakness here gives an alternative way into accounts that bypasses the password entirely: an attacker can reset the password of another user's account and sign in as that user, often without any action by the victim. Where the weakness affects any account, it can be used against administrators to take full control of the application. A successful reset also locks the legitimate user out, which may delay detection, and the impact is reduced where the account also requires multi-factor authentication that the reset process does not remove.

Variants met on tests include: reset tokens or codes that are short, sequential, time-based or otherwise predictable; tokens that do not expire, remain valid after use, or remain valid after a newer token has been issued; tokens that are not bound to the account, so a token issued for the attacker's account resets another user's password when the username or user identifier in the request is changed; reset requests that accept an extra or altered email address parameter and send the token there; tokens or codes returned in the application's response; numeric codes that can be guessed because attempts are not limited; reliance on security questions whose answers can be researched; and reset links sent over unencrypted HTTP or leaked to third parties in the Referer header.

Each is identified by requesting resets for test accounts, analysing the tokens issued, and replaying or modifying the reset requests.

Remediation

  • Generate reset tokens with a cryptographically secure random number generator, long enough to make guessing impractical (for example 128 bits or more of randomness), and store only a hash of each token.
  • Bind each token to a single account on the server, ignore any username, user identifier or email address supplied alongside the token, and send reset links only to the address already registered on the account.
  • Make tokens single use and short-lived, invalidate outstanding tokens when a new one is issued or the password is changed, and end existing sessions after a reset.
  • Limit attempts to submit numeric reset codes, and rate limit reset requests per account.
  • Never return tokens or codes in responses, and serve the reset page over HTTPS with Referrer-Policy: no-referrer so that the token is not sent to third parties.
  • Do not use security questions as the sole means of recovery, and require the existing second factor or a recovery code where the account has MFA.
  • Notify the user when a reset is requested and when it is completed.

Confirm the fix by repeating the reset tests, including replaying used and expired tokens and changing the account identifiers in reset requests.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Authentication and Sessions Findings

Every Authentication and Sessions finding