Review a Password Reset Flow for Account Takeover, Enumeration, and Token Handling Gaps

Review the account recovery (password reset) flow below for account takeover risks. Treat the code and description as the only facts available; do not assume protections that are not shown.

<flow_description>
[Describe the steps: how a reset is requested, what is sent, how the link or code is verified, what happens after the password is changed]
</flow_description>
<code>
[PASTE REQUEST, TOKEN GENERATION, VERIFICATION, AND PASSWORD UPDATE CODE]
</code>

Check and give a verdict (OK / Problem / Cannot tell) with evidence for each:

1. Token quality: Is the reset token generated with a cryptographically secure random source with enough entropy? Is it stored hashed rather than in plain text?
2. Expiry and single use: Does the token expire quickly? Is it invalidated after use and when a newer token is requested?
3. Binding: Is the token tied to the specific account, so it cannot be used for a different account by changing an identifier in the request?
4. Account enumeration: Do the response text, status code, and response time differ between known and unknown email addresses?
5. Rate limiting: Are requests limited per account, per address, and per IP, both for requesting resets and for guessing codes?
6. Delivery: Is the link built from a trusted configured base URL rather than from the request's Host header? Does the link or token appear in logs, referrer headers, or analytics?
7. After reset: Are existing sessions and refresh tokens revoked? Is the user notified by message at their existing address? Is multi-factor authentication still enforced?
8. Email change interplay: Can an attacker change the email on an account and then reset it?

Output a table of the eight checks, then the three most serious issues with an attacker-perspective description of how each would be exploited, a fix, and a regression test. List the questions you could not answer from the supplied material.

Sign in to upvote this prompt.