Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 38 ยท Vulnerable Components and Auth Failures

Identification and Authentication Failures

OWASP A07 explained: weak passwords, credential stuffing, broken session handling and missing MFA, with defensive checks you can run and apply to your own login.

Authentication answers "who are you?" and identification is the claim being checked, such as a username. When either is weak, attackers become other people without breaking any encryption: they just log in. OWASP lists these problems as Identification and Authentication Failures (A07). It used to be called Broken Authentication.

Authentication is different from authorization. Authentication establishes the user; authorization decides what that user may do. A system can get one right and the other wrong, and attackers need only one gap.

This lesson is defensive. The stand-ins evaluate sample data you create. Never test logins you do not own or lack written permission to test.

What goes wrong

Your login may be vulnerable if it:

  • Allows automated guessing: credential stuffing (replaying leaked username and password pairs from other breaches), brute force or password spraying.
  • Allows weak or common passwords, such as Password1.
  • Uses weak recovery, like security questions with guessable answers, or reset links that never expire.
  • Stores passwords in plaintext or with fast hashes (see Password Storage and Policy).
  • Has no multi-factor authentication for sensitive accounts.
  • Mishandles sessions: session IDs in URLs, no rotation after login, no expiry (see Sessions, MFA and Lockout).
  • Reveals whether an account exists through different messages or response times (user enumeration).

Attacks on the login

Credential stuffing Leaked pairs, tried everywhere.
Password spraying A few passwords, many accounts.
Brute force Many guesses, one account.

All of them depend on unlimited attempts.

1 / 2

Credential stuffing in one picture

People reuse passwords. When site A is breached, its list of emails and passwords is tried against sites B, C and D. The attacker does not guess; they replay. Defenses that stop guessing alone (strong password rules) do not stop this, because the leaked password may be strong. What helps: MFA, breached-password checks, rate limits per account and per IP and device signals, and bot detection.

A failed-login detector

Spotting these attacks starts with the log. The sample log below is invented. The code finds a source IP that fails many logins across many different accounts (spraying) and an account that fails many times from one source (brute force).

Python Detect spraying and brute force in a log

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real systems use time windows (failures per minute), not whole-log counts, and combine IPs with device and behavior signals, since attackers rotate addresses.

User enumeration

Compare two login responses:

  • "No such user" versus "Wrong password" lets an attacker collect valid usernames.
  • A generic "Invalid username or password" for both avoids it.

Timing leaks too: if a missing user returns instantly but an existing user takes 200 ms because a password hash runs, response time reveals accounts. The fix is to do equivalent work for both cases (hash a dummy password) and return identical messages. The same applies to "forgot password": say "If that email exists, we sent a link."

Python Uniform login responses

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Note this demo uses plain SHA-256 only to stay runnable; real password storage needs a slow, salted algorithm (next lesson).

Defender checklist

  • Require MFA for admin and high-value accounts, and offer it to everyone.
  • Check new passwords against a breached list and a common-password list.
  • Rate limit by account, by IP and globally; add progressive delays.
  • Use identical responses and comparable timing for login and recovery.
  • Rotate the session ID at login and expire sessions.
  • Never ship default credentials; force a change at first use.
  • Log failures and alert on spikes (see Logging and Monitoring Failures).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is credential stuffing?

    Credential stuffing relies on password reuse. The passwords may be strong; they are simply known to the attacker.
  2. 2. Why should login errors say the same thing for a missing user and a wrong password?

    Different messages let an attacker discover which usernames exist. Timing should match too.
  3. 3. Which defense helps most against stolen but valid passwords?

    A second factor means the password alone is not enough, even when it is correct.
  4. 4. Password spraying is best detected by looking for what?

    Spraying spreads a few guesses over many accounts to avoid per-account lockout, so detection must group by source and look across accounts.

Summary

  • A07 covers weak identity proof: guessable passwords, unlimited attempts, weak recovery and bad sessions.
  • Credential stuffing replays real leaked passwords; MFA and breach checks counter it.
  • Uniform messages and timing prevent user enumeration.
  • Detect spraying and brute force by grouping failures by source and by account.

Next: Password Storage and Policy