Authentication Security Fundamentals
Authentication is the process of verifying a user's identity—confirming they are who they claim to be. Session management extends that verification across multiple requests by issuing and validating session tokens. Failures in either system allow attackers to impersonate legitimate users.
Classified under OWASP A07: Identification and Authentication Failures and mapped to multiple CWEs including CWE-287 (Improper Authentication), CWE-384 (Session Fixation), and CWE-798 (Use of Hardcoded Credentials), authentication weaknesses are among the most exploited vulnerability classes.
Secure authentication requires multiple layers working together: strong password hashing (bcrypt, Argon2), rate limiting on login endpoints, secure session token generation (cryptographically random, sufficient entropy), proper cookie attributes (HttpOnly, Secure, SameSite), and session invalidation on logout. A weakness in any single layer can compromise the entire authentication system.
Modern applications also face authentication challenges from API tokens, OAuth flows, JWT implementations, and multi-factor authentication—each introducing additional attack surface that must be secured.
Common Authentication Vulnerabilities
Credential Stuffing and Brute Force
Attackers use lists of breached username-password pairs (credential stuffing) or systematically try password combinations (brute force) against login endpoints. Without rate limiting, account lockout, or CAPTCHA, these attacks succeed at scale. Billions of breached credentials are available for automated attacks.
Weak Password Storage
Storing passwords with MD5, SHA-1, or unsalted hashes allows attackers who gain database access to recover plaintext passwords using rainbow tables or GPU-accelerated cracking. Secure alternatives like bcrypt and Argon2 are deliberately slow, making brute-force infeasible.
Session Management Flaws
Predictable session tokens, sessions that persist after logout, session fixation (accepting attacker-set session IDs), and cookies missing HttpOnly or Secure flags all allow attackers to hijack user sessions without knowing their credentials.
Hardcoded Credentials
Default passwords, API keys embedded in source code, and hardcoded admin credentials in configuration files are discovered through code leaks, reverse engineering, or simple guessing. CWE-798 covers this class of weakness.
Insecure JWT Implementation
JWT vulnerabilities include accepting the "alg": "none" header (disabling signature verification), using weak signing secrets, not validating token expiration, and storing sensitive data in the unencrypted JWT payload.
Real-World Authentication Breaches
- LinkedIn (2012): 6.5 million password hashes were stolen and cracked. The passwords were hashed with unsalted SHA-1, allowing rapid recovery. LinkedIn later disclosed that 117 million accounts were actually affected.
- Yahoo (2013-2014): Attackers compromised 3 billion accounts across two separate breaches. Weak session management allowed the creation of forged authentication cookies without needing user passwords.
- Zoom (2020): Credential stuffing attacks using breached passwords from other services compromised over 500,000 Zoom accounts, which were sold on dark web forums.
- Okta (2022): Attackers gained access to Okta's customer support systems through compromised employee credentials, potentially affecting hundreds of organizations that relied on Okta for authentication.
These incidents demonstrate that authentication failures cascade: a weakness in one system can compromise users across multiple platforms due to password reuse and credential stuffing.
How CodeSlick Detects Auth Weaknesses
CodeSlick identifies authentication and session management weaknesses across JavaScript, TypeScript, Python, Java, and Go:
- Hardcoded credentials: 38 secret patterns including API keys, passwords, tokens, and private keys embedded in source code (CWE-798)
- Weak cryptography: MD5, SHA-1, and DES used for password hashing or token generation (CWE-327)
- Insecure session cookies: Missing
HttpOnly,Secure, andSameSiteattributes on session cookies - JWT vulnerabilities: Weak signing algorithms and missing validation checks
All findings include CWE mapping, CVSS scoring, and AI-powered fix suggestions that recommend secure alternatives specific to your framework and language.
Detect authentication and session management weaknesses in your application code.