Prompt
How do I design a recovery flow that doesn’t get abused?
Latest observation
A secure recovery flow should be easy for legitimate users, but hard to exploit for account takeover. The main idea is: treat recovery like a high-risk authentication path, with extra checks, limited power, and strong abuse controls.
Core design principles
1. Keep recovery channels separate from login
Don’t let a “forgot password” flow become a weaker version of login.
- Recovery should be distinct from regular sign-in
- Don’t reveal whether an account exists until necessary
- Don’t allow recovery to directly bypass high-risk protections without checks
2. Use multiple factors, but make them asymmetric
Recovery factors should not all be equally weak.
Good recovery options:
- Verified email link
- Verified phone, if you must use it
- Existing authenticated device
- Backup codes
- Recovery contacts / trusted devices
- WebAuthn/passkeys with a recovery fallback
Avoid relying only on:
- SMS
- Security questions
- Knowledge-based trivia
- Email alone for very sensitive accounts
3. Reduce account takeover risk by limiting what recovery can do
Recovery should not instantly give full privileges in risky cases.
For example:
- Allow password reset, but defer changes to payout details, MFA settings, or email
- Put temporary restrictions on high-risk actions after recovery
- Require step-up verification for sensitive changes
4. Make recovery tokens short-lived, single-use, and scoped
If using links or codes:
- Expire quickly
- Use one-time tokens
- Bind tokens to the intended purpose only
- Invalidate previous tokens when a new one is issued
- Store tokens hashed, not in plaintext
- Make them hard to guess and impossible to reuse
5. Rate-limit and monitor aggressively
Recovery is a favorite target for abuse and credential stuffing.
Apply limits to:
- Requests per account
- Requests per IP / ASN / device fingerprint
- Attempts per code / token
- Email/SMS sends
- Full recovery attempts per time window
Also add:
- Anomaly detection
- Reputation scoring
- Bot protection
- Alerting on repeated failures
6. Don’t leak useful signals
Attackers love confirmation that an account exists or that a contact point is valid.
Avoid:
- “That email address is registered”
- “We sent a code to ***1234”
- Detailed failure messages that distinguish invalid account vs invalid token vs expired token
Use neutral responses like:
- “If an account exists, we’ve sent instructions.”
7. Add step-up verification for risky recovery paths
If the user is changing:
- email address
- phone number
- MFA device
- password on a high-value account
- recovery method itself
then require stronger proof:
- passkey / WebAuthn
- backup code
- old authenticated device confirmation
- manual review for especially sensitive cases
8. Build in recovery locks and cooling-off periods
If a user changes recovery information, don’t allow immediate use of the new method for high-risk actions.
Examples:
- New email cannot be used for recovery for 24–72 hours
- New phone number has a delay before it becomes trusted
- Changes to MFA require confirmation from the old MFA method if possible
9. Make it observable and reversible
Recovery events should be logged and visible to the user.
Notify the user:
- Recovery request started
- Recovery completed
- Recovery method changed
- Password/MFA changed
- Unusual device/location used
Also provide:
- Session revocation
- Ability to undo recent changes where feasible
- Support escalation path for compromise
10. Prefer proof of possession over knowledge
The strongest recovery signals are things the attacker is least likely to have.
Examples:
- A trusted device already logged in
- A hardware security key
- A passkey
- Signed confirmation from a previously enrolled device
Common abuse patterns to defend against
Account enumeration
Fix with:
- Uniform responses
- Delayed responses
- No account existence leaks
Mass reset abuse
Fix with:
- Rate limits
- Bot detection
- Per-account cool-downs
- Abuse scoring
SIM swap / email takeover
Fix with:
- Don’t rely solely on SMS
- Treat email as recoverable but not definitive for high-risk accounts
- Add step-up checks for sensitive changes
Token interception
Fix with:
- Short TTL
- One-time use
- HTTPS only
- Avoid displaying recovery codes on screen after generation
- Use secure, signed, scoped tokens
Social engineering of support staff
Fix with:
- Strong support verification policy
- Limited support permissions
- Mandatory logging
- Escalation rules for risky recovery
A good recovery architecture
A robust setup often looks like this:
- User requests recovery
- System applies anti-abuse checks
- Send neutral response
- Deliver a short-lived, single-use recovery method
- Verify ownership using one or more factors
- Allow password reset or session recovery
- Temporarily restrict high-risk actions
- Notify user on all known channels
- Log and monitor the event
- Require stronger auth before changing recovery settings
Practical recommendation
For most products, a strong baseline is:
- Passkeys/WebAuthn for primary auth
- Verified email as recovery
- Backup codes
- Trusted device confirmation
- Step-up auth for changing recovery settings
- Rate limits + neutral responses + alerts
If you want, I can also help you design:
- a consumer app recovery flow,
- an enterprise/support-assisted recovery flow, or
- a technical architecture with state machine and abuse controls.
Brands