Software Securityhome
Fix a findingSearch
Tag

Authentication and sessions

12 guides tagged Authentication and sessions, grouped by topic, with the SDLC phase and role each is written for.

SDLC phases
Roles

Application security

2 guides

Runtime, cloud & APIs

2 guides

Identity & cryptography

8 guides
Guide · Identity & cryptography

Session management: cookies, timeouts, rotation and revocation

Model authentication as transitions in server authority, set session cookies and timeouts to current NIST and OWASP values, and verify fixation prevention, expiry, reauthentication, revocation and stolen-cookie defenses.

Development · Developers

Guide · Identity & cryptography

Password storage: hashing parameters and rehash on login

Choose Argon2id, scrypt, PBKDF2 or bcrypt with current minimum parameters, store a versioned hash, and upgrade old hashes after a successful login without overwriting a reset.

Development · Developers

Guide · Identity & cryptography

OAuth 2.0 and OpenID Connect login: authorization code with PKCE

Implement OAuth 2.0 and OpenID Connect login with the authorization code flow and PKCE, keep each transaction bound to its browser, and block redirect, mix-up, code-injection and token-theft attacks.

Development · Developers

Guide · Identity & cryptography

Account recovery: password resets, help-desk resets and account linking

Treat password resets, support-desk recovery and account linking as new grants of authority: single-use high-entropy proofs, atomic consumption, session revocation, and stable identity rather than email matching.

Development · Developers, AppSec engineers

Guide · Identity & cryptography

SAML single sign-on: verify signed assertions without losing the identity boundary

Bind a validated SAML assertion to its trusted issuer, the exact signed element, your service, the browser request and a replay record before creating a local session, and keep your SAML library ahead of its advisories.

Development · Developers

Guide · Identity & cryptography

Stop account takeover with the right MFA and login defenses

Rank MFA options by the attacks they stop, implement TOTP and push approvals correctly, and close the login, reset and recovery paths that attackers use instead of breaking the second factor.

Development · Developers, AppSec engineers

Guide · Identity & cryptography

Defend OAuth and OIDC against redirect and token attacks

Apply RFC 9700 and RFC 10017: exact redirect matching, PKCE with downgrade protection, state and iss binding, refresh-token rotation, sender-constrained tokens, and a backend-for-frontend so browser tokens cannot be stolen.

Development · AppSec engineers

Case study · Identity & cryptography

Case study: the Okta support-system breach and session tokens in HAR files (2023)

How a service account password saved to a personal browser profile let an attacker download customers' HAR files from Okta's support system, replay the session tokens inside them against five customers, and stay unseen for two weeks; and why HAR files are credentials, admin sessions need binding, and every exposed credential must be rotated.

Development, Maintenance · Developers, Platform engineers and SREs

Practice

Browser lab · Practitioner · 25–40 min

Password reset token lab: Make a recovery credential single-use

A recovery link can be redeemed twice when two requests arrive together. Repair redemption so token validation and account changes share one atomic operation.

Browser lab · Practitioner · 25–40 min

Business logic lab: Price an order without trusting the client

A checkout trusts the price and quantity each cart line sends, adds every coupon code it recognizes, and never limits redemptions. Customers can choose their price, order negative quantities and stack discounts. Repair the pricing function so every amount comes from server data and every coupon rule holds.

Browser lab · Advanced · 30–45 min

OAuth redirect and PKCE lab: Match redirect URIs and verify PKCE

An authorization server accepts any redirect_uri that starts with a registered one, skips PKCE for codes issued without a challenge and accepts the plain method. Repair both checks so stolen or injected codes cannot be redeemed.

Browser lab · Practitioner · 25–40 min

Password hashing lab: Verify and upgrade an Argon2 password hash on login

A login check verifies stored password hashes but never upgrades a weak or outdated one, so hashes created with tiny parameters or the wrong Argon2 variant stay that way forever. Repair check_login to verify with Argon2id at the policy minimum and rehash on a successful login.

Fix card · CWE-330, CWE-338

Insecure randomness for security tokens

A password-reset token or session ID is only as strong as the randomness behind it.

Fix card · CWE-306, CWE-287

Missing authentication for a critical function

Missing authentication for a critical function happens when a route that returns user or internal data runs without a verified caller: the endpoint has no authentication, or it reads identity from the request itself (a userId parameter, an X-Authenticated-User header an upstream proxy was supposed to set) and so authenticates nothing.

Fix card · CWE-384, CWE-613, CWE-614, CWE-1004, CWE-1275

Session fixation and session cookies

A session cookie is a bearer credential: whoever presents its value is the signed-in user.

All tags, lifecycle stages and roles

Find your next answer

Type to search. Search runs in your browser.

Searches run in your browser, but the host can infer them from the index files they load. The address shows your search so you can bookmark or share it.