Broken authentication and login bypass: the flaws that let someone sign in as someone else

The authentication failures behind most account takeovers — logic flaws in login and reset flows, missing rate limits, weak MFA enrollment, verbose errors, and default credentials — and a checklist to review a login flow end to end.

Lesson 15 of 69 · 14 min read · practice only with authorization

Diagram

A sign-in flow and where it breaks

Follow the path. One example at a time.

Step 1 of 4

Identify

Username or email entered; errors should not reveal whether it exists.

Illustration: Identify
# Identify
# Username or email entered; errors should not reveal
# whether it exists.

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Step-skipping

    What fails
    Multi-step logins that trust a client-sent step or flag let someone jump past MFA.
    Who is affected
    Every account with MFA enrolled.
    What you would notice
    Login state stored in hidden fields, cookies, or JSON the client sends back.
    What you change
    Keep login state server-side and check every prior step before granting a session.
  2. Account enumeration

    What fails
    Different errors or timings for unknown users make spraying and stuffing efficient.
    Who is affected
    All users, by narrowing attacker guesses.
    What you would notice
    “No such user” versus “Wrong password”, or a measurably faster response for unknown names.
    What you change
    Return one generic message and equalize timing.
  3. Defaults and recovery

    What fails
    Default admin passwords and weak reset flows bypass the login entirely.
    Who is affected
    Administrators and every user whose reset can be redirected.
    What you would notice
    admin/admin on an appliance, or a reset link that works more than once.
    What you change
    Force credential change on first boot and make reset tokens single-use, short-lived, and bound to the account.

Review checklist for a login flow

Walk the flow in a proxy with a test account and check each item. Most findings come from the transitions between steps, not from the password check itself.

  • Generic errors and equal timing for unknown users
  • Rate limits per account and per source
  • Password hashes with Argon2id or bcrypt
  • MFA enforced server-side, no client-controlled step flags
  • Session id rotated after full authentication
  • Reset tokens single-use, short-lived, and bound to the account
  • No default credentials on admin interfaces

Testing step order safely

With your own test account, complete the password step, then send the request for the final step directly, skipping MFA. A correct implementation refuses. Replay an old reset token after using it once; it should be rejected.

POST /login/password  (test user, correct password) -> 200 {"next":"mfa"}
GET  /account                                      -> 302 /login  ok
POST /login/finish   (no MFA)                       -> 200 Set-Cookie: session=...  <- finding

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A login sends {"mfa_passed": true} from the browser to finish sign-in. What is the flaw?

Go deeper

Specific techniques, exercises, and glossary cards for this topic.

  1. 01Login CSRFA login is a state change. Includes the diagram and a defensive fix.
  2. 02Breached passwords and credential stuffingA password reused from another site will be tried on yours. Includes the diagram and a defensive fix.
  3. 03Password reset tokensA reset token is a password that expires. Includes the diagram and a defensive fix.
  4. 04Credential stuffing: spotting reused passwords tried at scaleCredential stuffing replays username and password pairs leaked from other sites. Includes the diagram and a defensive fix.
  5. 05Password spraying: a few common passwords against many accountsSpraying tries one or two likely passwords across every account to stay under lockout thresholds. Includes the diagram and a defensive fix.

Exercises

  1. 01Evidence deskRead a query review and a server-side fetch that were already collected. Name the failure and the fix.
  2. 02Password policy and hash cost explorerChange length, character sets, and hash algorithm, and watch the offline guessing time move. Then test which policy-compliant passwords fall first anyway.
  3. 03Terminal mission: One password, eleven accountsRead Kerberos pre-authentication failures (4771) on a domain controller, recognise a password spray by its shape, and find which sprayed accounts then received a TGT.
  4. 04Terminal mission: A spray over IMAP that skipped MFASpot a password spray against Exchange Online over IMAP in Entra sign-in logs, find the account that worked, and read why conditional access never asked it for MFA.
  5. 05Terminal mission: A spray and a brute force in one logTwo addresses failed logins on sso-gw in the same ten minutes. One hammered one account; the other tried one password on many. Tell them apart and count the accounts sprayed.

Glossary

  1. 01Credential stuffingPasswords leaked from other sites are tried at scale against your login.
  2. 02Password sprayingA few common passwords are tried across many accounts, often staying under per-account lockout thresholds.