What does 'Broken Authentication' mean in the OWASP Top 10, and what are its common causes and fixes?
Answer
Broken authentication is a broad category covering any weakness that lets an attacker assume another user's identity. In the OWASP Top 10 it sits under 'Identification and Authentication Failures'. It includes weak password handling, poor session management, missing MFA and flawed account recovery. Because authentication is the front door, a single flaw here can expose every account, which is why it is consistently one of the highest-impact categories.
Where authentication breaks
Weak credential policy: allowing common or breached passwords, no limit on login attempts, or no protection against automated guessing.
Credential stuffing: attackers replay username and password pairs leaked from other breaches. Because people reuse passwords, this works at scale, so rate limiting, bot detection and MFA matter more than complexity rules.
Bad password storage: storing plaintext, using fast or unsalted hashes like MD5 or SHA-256, instead of a slow adaptive algorithm.
Broken session management: predictable session IDs, tokens that never expire, not rotating the session ID after login (session fixation), or exposing tokens in URLs.
Missing or weak MFA: no second factor, or SMS OTP that can be phished or SIM-swapped.
Flawed recovery: 'forgot password' flows that leak whether an account exists, use guessable security questions, or send reset links that do not expire.
How to store passwords correctly
Use a slow, salted, memory-hard hash designed for passwords. The current recommendations are Argon2id (preferred), scrypt, or bcrypt where libraries are mature. Each password gets a unique random salt, and the work factor is tuned so a single hash takes a noticeable fraction of a second. Never use plain MD5, SHA-1 or SHA-256, which are fast and built for integrity, not password storage.
Hardening the whole flow
Area
Control
Passwords
Check against breach lists, allow long passphrases, store with Argon2id
Brute force
Rate limit, add exponential backoff and CAPTCHA, lock or step up after failures
Second factor
Offer TOTP or WebAuthn; prefer phishing-resistant passkeys
Sessions
Long random IDs, rotate on login, idle and absolute timeouts, HttpOnly Secure cookies
Recovery
Time-limited one-use tokens, generic responses that do not reveal account existence
Messaging
Identical 'invalid credentials' for wrong user and wrong password
Common mistakes
Telling the user whether the email or the password was wrong, which enables username enumeration.
Keeping the same session ID before and after login, enabling session fixation.
Adding MFA only on login but not on sensitive actions like changing the password or payout account.
Treating password complexity rules as the main defence while ignoring credential stuffing.
A hardened login flow. Each stage closes a specific authentication weakness.
Rate limit and bot check: Blunts credential stuffing and brute force.
Verify password hash: Compare against an Argon2id hash, generic errors only.
Second factor: TOTP or WebAuthn, ideally phishing-resistant.
Rotate session ID: New ID after login prevents fixation.
Set secure cookie: HttpOnly, Secure, SameSite with timeouts.
Code examples
Hash and verify a password with Argon2id (Node.js)
import argon2 from 'argon2';
// On signup: hash with Argon2id, a unique salt is added automatically
const hash = await argon2.hash(password, {
type: argon2.argon2id,
memoryCost: 19456, // ~19 MB, tune to your hardware
timeCost: 2,
parallelism: 1,
});
// store `hash` only; never store the raw password
// On login: verify in constant time, return a generic error on failure
const ok = await argon2.verify(hash, submittedPassword);
if (!ok) return res.status(401).json({ error: 'Invalid credentials' });
Argon2id is memory-hard, so it resists GPU cracking. The library stores the salt and parameters inside the hash string, and verify runs in constant time to avoid leaking information.
Key points
Broken authentication covers weak passwords, bad sessions, missing MFA and flawed recovery.
Credential stuffing is the dominant attack; MFA and rate limiting beat complexity rules.
Store passwords with Argon2id, scrypt or bcrypt and a unique salt, never MD5 or SHA-256.
Rotate the session ID after login to prevent session fixation.
Use generic error messages so attackers cannot enumerate valid usernames.
Common follow-up questions
Why is bcrypt or Argon2id better than SHA-256 for passwords?
What is credential stuffing and how is it different from brute force?
What is session fixation and how does rotating the session ID stop it?
Why is SMS OTP weaker than a hardware security key?
Interview tips
Name a specific password hash (Argon2id) and say why fast hashes are wrong; it shows real knowledge.
Bring up credential stuffing and MFA; interviewers want to hear more than 'use strong passwords'.
Mention generic error messages and session rotation to show attention to detail.