At a glance
- Controls
- CWE-640 · A07:2021 Identification and Authentication Failures
What it is
A reset link holds a token that lets the holder set a new password. It should work once, for a short time, and only for one account. Weak flows let the token be reused, keep it valid for days, or leave old tokens live after a new one is sent.
An attacker finds an old reset link in a forwarded email, a shared inbox, browser history or a log file. They use it to set a new password and lock out the owner. AI-assisted attackers test token reuse, expiry and account binding in one automated pass.
Where it hides
What a reviewer can look for in the code and in the behaviour, before anyone proves it.
- The reset confirm endpoint that accepts the token and new password
- Tokens stored without a used flag or expiry time
- Reset tokens that can be swapped onto a different email or user ID in the request
- Logs or analytics that record full reset URLs
How MATT tests it
The proof runs against the deployed product, on every release, whoever wrote the code.
- 01Read the code to see how reset tokens are created, stored, expired and cleared.
- 02Request a reset for a test account, use the link once, then try the same link again.
- 03Request two resets for the test account and try the first link after the second one is issued.
A reset token must work once, for a short time, for one account.
Executable checkas test user: use reset token T once use reset token T again expect: rejected use a token older than the expiry time expect: rejected
Every rule MATT holds →What the fix looks like
- 01
Store each token hashed, with a short expiry and a used flag, and mark it used on success.
- 02
Cancel every older token for the account when a new one is issued or the password changes.
- 03
Bind the token to one account on the server and ignore any user ID sent with it.
- 04
End existing sessions after a successful reset.
A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →