1 Password Reset Attack Vectors
Password reset mechanisms are high-value targets because they provide an alternative path to account takeover without knowing the password.
Guessable reset tokens:
# Vulnerable: time-based or sequential token
token = str(int(time.time())) # Predictable!
token = hashlib.md5(email.encode()).hexdigest() # Deterministic — no randomness!Token not expiring: A reset token emailed to a user must expire (typically 15-60 minutes). If tokens never expire, an attacker can target old email breaches.
User enumeration via error messages:
# Vulnerable: reveals whether email exists
if not user_exists(email):
return "No account found for this email" # Attacker now knows!
return "Reset link sent"Token not invalidated after use: A reset token used once should be immediately invalidated. If it can be reused, an attacker who intercepts the email link can reset the password again later.