Authentication & Session Security
Authentication & Session Security
Authentication decides who someone is; session management decides how long they stay trusted. Flaws here are high impact because they lead straight to account takeover. Many are configuration-level and quietly shipped by default: tokens that never expire, cookies missing security flags, or login endpoints with no rate limiting.
Missing Session Expiry & Rotation
CWE-613OWASP ASVS 3.3- What it is
- Sessions have no absolute or idle timeout, or are not rotated when privileges change, so a captured session stays valid indefinitely.
- Why it matters
- A stolen or fixated session grants long-lived access and survives password changes.
- How to check
- Set absolute and idle timeouts, and rotate the session id on login and privilege change.
Insecure JWT Handling
CWE-347- What it is
- Tokens accept the none algorithm, use a weak secret, or are not validated for expiry, audience, and issuer.
- Why it matters
- Attackers forge or extend tokens and impersonate any user.
- How to check
- Pin the algorithm, use a strong secret or asymmetric keys, and verify exp, aud, and iss on every request.
Insecure Cookie Flags
CWE-614- What it is
- Session cookies are missing HttpOnly, Secure, or an appropriate SameSite setting.
- Why it matters
- Session theft via script access or transmission over insecure channels, and CSRF exposure.
- How to check
- Set HttpOnly, Secure, and SameSite on all session cookies.
No Brute-Force Protection
CWE-307- What it is
- Login, reset, or token endpoints have no rate limiting or lockout.
- Why it matters
- Credential stuffing and password guessing at scale.
- How to check
- Rate-limit authentication endpoints and add progressive delays or lockouts.
Account Enumeration
CWE-204- What it is
- Login or password-reset responses differ depending on whether an account exists.
- Why it matters
- Attackers build valid account lists to target with phishing and credential stuffing.
- How to check
- Return identical responses and timing whether or not the account exists.
In-depth guides
Observable Response Discrepancy
An application returns different responses for valid and invalid inputs, so an attacker can learn which accounts, emails, or records exist.
CWE-307Improper Restriction of Excessive Authentication Attempts
An authentication endpoint accepts unlimited attempts, so an attacker can guess passwords or codes by trying as many as they like.
CWE-347Improper Verification of Cryptographic Signature
An application accepts a signed token, webhook, or message without properly verifying its signature, so an attacker can forge or tamper with it.
CWE-613Insufficient Session Expiration
Sessions or tokens stay valid too long or never expire, so a stolen or stale credential keeps working long after it should.
CWE-614Sensitive Cookie in HTTPS Session Without Secure Attribute
A session cookie is set without the Secure, HttpOnly, or SameSite flags, so it can be stolen over plain HTTP, read by scripts, or sent in cross-site requests.
Related coverage
Check your code for authentication & session security
Tethlyn Audit checks your codebase for authentication & session security and more, then ranks each finding by real exploitability and data sensitivity.