Skip to content

Broken Authentication & Session Hijacking

Prevent session fixation, credential stuffing, reset-token leakage, and insecure cookies by hardening your web application's authentication lifecycle.

By BugSnaps Security Research · 1 min read · Updated

Add BugSnaps as a preferred source on Google(opens in a new tab)

Want more of our security guides? Select BugSnaps and confirm your choice on Google.

Authentication and session management define who a caller is on every HTTP request. If an adversary can guess credentials without throttling, hijack an unrotated session identifier, or intercept a leaked password-reset token, every downstream authorization check is compromised.

Four authentication and session flaws to test before launch

Even when teams use established identity libraries, custom login wrappers, password recovery routes, and cookie settings frequently introduce exploitable gaps:

  • Session fixation and missing rotation: failing to issue a fresh session identifier when a user logs in or elevates privileges, or failing to invalidate the server-side session token when the user clicks log out.
  • Unthrottled login and OTP endpoints: allowing thousands of rapid credential-stuffing or 6-digit OTP guesses on `/api/login` or `/api/verify-otp` without per-account and per-IP rate limiting and lockout.
  • Missing cookie security attributes: issuing session cookies without `Secure`, `HttpOnly`, and `SameSite` flags, or scoping cookies broadly to a parent domain where sibling subdomains can read or overwrite them.
  • Password-reset token leakage and reuse: placing single-use reset tokens in URLs where third-party scripts or `Referer` headers leak them, failing to expire tokens after one use, or accepting host-header poisoning when building reset links.

Checklist for a resilient session lifecycle

Hash stored passwords with Argon2id or bcrypt, enforce rate limiting and multi-factor authentication (WebAuthn/Passkeys or TOTP) on sensitive accounts, and bind password-reset URLs to a hardcoded canonical origin rather than the incoming HTTP `Host` header.

Store primary session identifiers in `Secure`, `HttpOnly`, `SameSite=Lax` (or `Strict`) cookies—preferably using the `__Host-` cookie prefix—rotate session tokens on login and password change, and revoke all active sessions in your server store whenever a user resets a password or changes multi-factor authentication settings.

Keep session tokens out of localStorage, enforce Secure and HttpOnly cookie attributes, and invalidate server-side sessions on logout and password reset.

Run a vulnerability scan on your website.

Verify your domain and use MyPentest to check for supported web and API weaknesses. Review findings and coverage; a clean scan does not rule out every CVE.