Identification and Authentication Failures
7) Identification and Authentication Failures
What it is
This category means the app fails at proving identity safely.
Simple split:
- Identification = “Which account is this?” (username/email/user ID)
- Authentication = “Prove it is really you.” (password, MFA, token, biometric)
If these controls are weak, attackers log in as other users.
Very common failures
- Weak password policy (123456, short passwords allowed).
- No MFA for risky users/actions.
- No rate limiting on login (easy brute force).
- Credential stuffing not blocked (reused leaked passwords).
- Session IDs are predictable or not rotated after login.
- Sessions never expire.
- “Remember me” tokens are weak or never revoked.
- Password reset flow is weak (guessable token, long token lifetime).
- User enumeration via login errors (“email not found” vs “wrong password”).
Step-by-step attack examples
Example A: Credential stuffing
- Attacker gets leaked username/password list from another breach.
- Attacker tries same combos on your login API automatically.
- Users who reused passwords get compromised.
- Attacker enters real accounts without breaking encryption.
Example B: Brute force due to no rate limit
- Attacker targets one account.
- Sends thousands of password guesses quickly.
- No lockout/rate limit/challenge stops attempts.
- Eventually one guess works.
Example C: Session fixation / weak session handling
- Attacker forces victim to use a known session ID.
- Victim logs in with that session.
- Server does not rotate session after authentication.
- Attacker reuses same session ID and hijacks account.
Tricky concepts explained
1) Authentication vs authorization
- Authentication = prove identity.
- Authorization = decide permissions after login.
You need both. A user can be authenticated but still not authorized for admin actions.
2) MFA (Multi-Factor Authentication)
MFA means using at least two different factor types:
- Something you know (password)
- Something you have (authenticator app/token)
- Something you are (biometric)
Important:
- SMS MFA is better than nothing, but vulnerable to SIM-swap.
- Authenticator app or hardware key is stronger.
3) Session management
After login, the app gives a session/token. If session handling is weak, attackers can bypass password entirely.
Must-have behavior:
- Random, high-entropy session IDs
- Rotate session ID after login and privilege change
- Short idle timeout and absolute timeout
- Invalidate session on logout/password change
4) User enumeration
If login says “user not found,” attacker learns valid accounts. Better:
- Use generic error like “Invalid credentials.”
- Keep response behavior consistent.
How to prevent it (clear implementation order)
- Enforce strong password policy and block common leaked passwords.
- Store passwords with strong hashing (Argon2id, bcrypt, or scrypt).
- Add MFA, at least for admins and high-risk actions.
- Add login rate limiting, lockout/backoff, and bot defenses.
- Detect and block credential stuffing patterns.
- Use secure session cookies: HttpOnly, Secure, SameSite.
- Rotate session/token after login and privilege elevation.
- Set session expiration (idle + max lifetime).
- Build secure password reset:
- Use random single-use tokens.
- Set short expiry.
- Invalidate old tokens when new one is issued.
- Re-authenticate users for sensitive actions (email/password change, payouts).
- Use generic authentication error messages.
- Log and alert on suspicious auth events (impossible travel, many failures).
Detection checklist
- Can I brute-force login quickly from one IP or many IPs?
- Are reused leaked passwords accepted?
- Is MFA required where risk is high?
- Does session ID rotate right after login?
- Are old sessions invalidated after password reset/change?
- Do login errors reveal valid usernames/emails?
- Are suspicious auth events monitored and alerted?
Business impact
- Account takeover.
- Fraud and unauthorized transactions.
- Data theft and privacy incidents.
- Admin compromise leading to full environment breach.