Authentication & Session Management — OWASP Top 10
Authentication failures let attackers guess, steal or reuse identities. Controls checklist MFA for all users, mandatory for admins; prefer passkeys/WebAuthn. Rate-limit and throttle login, OTP and password-reset endpoints; add exponential delays. Check new passwords against breached-password lists; require length (≥ 12) over complexity rules. Generic errors: "Invalid username or password" — never reveal which one was wrong. Session IDs: long random values, regenerated after login, invalidated on logout and after idle/absolute timeouts. Cookies: Secure; HttpOnly; SameSite=Lax (or Strict), Host- prefix. Password reset: single-use, short-lived tokens; don't log them. JWTs: verify signature and alg, exp, aud, iss; keep them short-lived.
Key Takeaways
Throttle authentication endpoints per account and per IP.
Return the same error for unknown users and wrong passwords.
Regenerate the session ID on login and set Secure, HttpOnly and SameSite.
Offer MFA or passkeys and block known-breached passwords.