Back

A2:2017 - Broken Authentication - Overview

What is Broken Authentication?

Broken Authentication was ranked A2 in the OWASP Top 10 2017. It covers the whole family of weaknesses in how an application confirms who a user is (authentication) and keeps them signed in (session management). When these functions are implemented incorrectly, attackers can compromise passwords, keys, or session tokens—or exploit other flaws—to assume other users' identities, temporarily or permanently.

The category is deliberately broad because authentication is not one control but a chain of them: the login form, the password store, the "remember me" feature, the password-reset email, the multi-factor step, the session cookie, and the logout button are all part of the same trust boundary. A single weak link—a login endpoint with no rate limiting, a session ID that never rotates, a reset token that never expires—can undo every other control. Broken Authentication is what happens when any part of that chain lets an attacker in as someone else.

2017 → 2021 lineage: In the OWASP Top 10 2021, this category was renamed and broadened to A07:2021 - Identification and Authentication Failures, and it moved down from #2 to #7 (a sign that frameworks and managed identity providers have made secure defaults more common, not that the risk disappeared). This lesson focuses on the 2017 A2 framing, but the weaknesses and fixes carry directly over.

Core Concept

Secure authentication and session management:
  Passwords     -> hashed with bcrypt / Argon2 / scrypt, never plaintext
  Weak/breached -> rejected at registration and password change
  Login         -> rate limited, lockout / backoff, generic error messages
  MFA           -> available and enforced for sensitive accounts
  Session ID    -> long, random, server-generated, in a cookie (never the URL)
  Cookie flags  -> Secure; HttpOnly; SameSite set
  On login      -> a NEW session ID is issued (prevents fixation)
  Timeout       -> idle + absolute limits, server-side invalidation on logout

Broken authentication:
  Passwords     -> plaintext, or unsalted MD5 / SHA-1
  Weak/breached -> "password", "123456", known-breached values accepted
  Login         -> unlimited attempts, "user not found" vs "wrong password"
  MFA           -> absent, or trivially bypassed via a fallback flow
  Session ID    -> short/predictable, or passed in the URL query string
  Cookie flags  -> missing Secure / HttpOnly, readable by script or sniffable
  On login      -> the pre-login session ID is kept (session fixation)
  Timeout       -> sessions never expire, logout does not invalidate server-side

Where Authentication Breaks Down

The OWASP 2017 definition lists concrete conditions. An application is likely vulnerable if it:

Why Does This Matter?

Authentication is the gatekeeper to everything else. Access control, encryption, and audit logging all assume the system knows who is acting. When authentication breaks, those downstream controls protect the wrong person—often silently, because the attacker arrives holding a valid-looking identity.

Business Impact

Technical Impact

Technical Context

Authentication vs Session Management vs Authorization

These three terms are constantly confused, and Broken Authentication spans the first two. Keeping them distinct is essential to reasoning about the fixes.

ConceptQuestion it answersTypical mechanismFailure mode in A2
AuthenticationWho are you?Password + MFA, verified against a stored hashWeak passwords, no MFA, poor hashing, guessable reset
Session managementAre you still the same person?Session ID in a cookie, or a signed tokenFixation, exposure in URL, no timeout, no invalidation
AuthorizationAre you allowed to do this?Roles / permissions checked per request(Covered by A5:2017 Broken Access Control, not A2)

The Session Lifecycle

Most session flaws come from mishandling one of the transitions below. A robust implementation issues a fresh, unpredictable identifier at login and destroys it completely at logout.

1. Anonymous visit   -> server may issue a pre-auth session ID (cart, CSRF token)
2. User logs in      -> ISSUE A NEW SESSION ID here (do not reuse the pre-auth one)
3. Authenticated use -> session ID travels in a Secure; HttpOnly cookie each request
4. Idle              -> session expires after N minutes of inactivity (idle timeout)
5. Long-lived        -> session expires after an absolute max age regardless of activity
6. Sensitive action  -> optionally re-authenticate (step-up) before it proceeds
7. Logout / password change -> DESTROY the session server-side, not just client-side

Why Password Storage Belongs Here

Password storage sits at the boundary of A2:2017 (Broken Authentication) and A3:2017 (Sensitive Data Exposure, later renamed Cryptographic Failures). The reason it matters for authentication is simple: every password database eventually risks exposure, and the only thing standing between a stolen dump and mass account takeover is the strength of the hashing. Fast, unsalted hashes (MD5, SHA-1, plain SHA-256) can be reversed at billions of guesses per second with commodity GPUs; slow, salted, memory-hard functions (bcrypt, scrypt, Argon2) make offline cracking economically impractical.

Password store leaks. What happens next depends entirely on the hash:

  plaintext            -> every account owned instantly
  unsalted MD5 / SHA-1 -> cracked with rainbow tables / GPUs in minutes
  fast salted SHA-256  -> no rainbow tables, but still billions of guesses/sec
  bcrypt / Argon2      -> each guess is deliberately slow; cracking is impractical

Real-World Impact

The incidents below are described as verifiable classes of event that are well documented in the security community. Exact figures vary by source and are given qualitatively; treat them as illustrative of the mechanism, not as precise statistics.

Case Class 1: Aggregated Credential Dumps Fueling Credential Stuffing

What happened: Over the 2010s, breaches at many large services produced enormous collections of leaked email/password pairs, which were aggregated and traded (the widely-reported "Collection #1" compilation is one example that circulated publicly).

Mechanism: Attackers replay these pairs against unrelated sites, betting on password reuse. Sites without bot defenses or rate limiting see login endpoints hammered with valid-format guesses, and a small success rate across millions of attempts still yields many compromised accounts.

Lesson: Password reuse turns someone else's breach into your account-takeover problem. Defenses must assume the attacker already knows real passwords.

Case Class 2: Streaming, Retail, and Gaming Account Takeover Waves

What happened: Consumer platforms with valuable accounts (media libraries, stored payment methods, loyalty balances) have repeatedly experienced publicized credential-stuffing waves, prompting forced password resets and public advisories.

Mechanism: High-value accounts + widespread password reuse + weak automated-attack defenses. The underlying application flaw is the same each time: authentication that treats a correct-looking password as sufficient proof, with no throttling or anomaly detection.

Lesson: Rate limiting, device/behavior signals, and MFA are what separate "one leaked password" from "account compromised."

Case Class 3: MFA-Fatigue and Fallback-Flow Bypasses

What happened: Several widely-reported intrusions succeeded despite MFA being present, by abusing weak MFA implementations—push-notification "fatigue" (spamming approve prompts until a tired user taps yes), SMS interception, or a weaker fallback/recovery flow that skipped the second factor.

Mechanism: MFA that can be socially or technically bypassed is only as strong as its weakest path. A recovery flow that emails a login link, or a "trust this device" option with no verification, can undo the second factor entirely.

Lesson: MFA must be phishing-resistant where possible (WebAuthn/FIDO2), number-matching for push, and every recovery/fallback path must be at least as strong as the primary one.

Case Class 4: Session Tokens Exposed in URLs and Logs

What happened: Applications that placed session identifiers in URL query strings (?sessionid=...) leaked those tokens into browser history, proxy and server access logs, analytics pipelines, and the Referer header sent to third-party sites.

Mechanism: A session ID is a bearer credential—whoever holds it is the user. Once it appears in a log or a referrer, anyone with access to that log or that third-party site can replay it.

Lesson: Session IDs belong in cookies with Secure; HttpOnly; SameSite, never in the URL.

Prevalence and Statistics

OWASP Top 10 2017 Positioning

Representative CWE Mappings

OWASP maps this category to a set of Common Weakness Enumeration entries. The most relevant to authentication and session management include:

CWEWeakness
CWE-287Improper Authentication
CWE-384Session Fixation
CWE-613Insufficient Session Expiration
CWE-620Unverified Password Change
CWE-640Weak Password Recovery Mechanism
CWE-521Weak Password Requirements
CWE-307Improper Restriction of Excessive Authentication Attempts
CWE-798Use of Hard-coded Credentials
CWE-256Plaintext Storage of a Password
CWE-916Use of Password Hash With Insufficient Computational Effort
CWE-598Use of GET Request Method With Sensitive Query Strings (session IDs in URL)

Common Misunderstandings

Myth 1: "HTTPS means my authentication is secure."

Reality: TLS protects credentials in transit. It does nothing about weak passwords, missing rate limiting, session fixation, poor hashing, or a guessable reset token. HTTPS is necessary but nowhere near sufficient.

Myth 2: "We hash passwords, so a database leak is fine."

Reality: The algorithm decides your fate. Unsalted MD5/SHA-1 is cracked almost as fast as plaintext with modern GPUs. Only slow, salted, memory-hard hashes (bcrypt, scrypt, Argon2) make a leaked store expensive to crack.

Myth 3: "Account lockout after 5 failures stops attackers."

Reality: Lockout stops vertical brute force against one account, but does nothing against credential stuffing and password spraying, which try one password across many accounts. Worse, naive lockout enables denial-of-service (lock every user out by failing their logins). Rate limiting, backoff, and bot defenses matter more than a hard lockout.

Myth 4: "Logout just needs to delete the cookie."

Reality: If the server keeps the session valid, an attacker who already copied the session ID (or a stateless token that has not expired) is still logged in. Logout must invalidate the session server-side, and password changes should invalidate all other sessions.

Myth 5: "Any second factor makes us safe."

Reality: SMS codes can be intercepted or SIM-swapped, push prompts can be spammed until approved, and a weak recovery flow can skip MFA entirely. The strength of MFA is the strength of its weakest path, including recovery.

Myth 6: "Complex password rules (symbols, forced 90-day rotation) are best practice."

Reality: Modern guidance (NIST SP 800-63B) favors length and screening against breached passwords over arbitrary composition rules and forced periodic rotation, which push users toward predictable patterns (Password1!Password2!). Check against known-breached lists instead.

Self-Assessment

Use these questions to gauge whether an application is exposed to Broken Authentication. A "no" to any of them is a finding worth investigating.

Next Steps

Ready to practice? Start the Broken Authentication lab from ./lab/broken-authentication/ with docker-compose up --build and work through identifying, exploiting, and fixing the flaws described here.