Cybersecurity Glossary

What is Session Management?

Session management maintains a user's authenticated state across multiple requests. After successful authentication, the client receives a random session identifier or token. The server associates identity, permissions and security state with that proof until the session expires or is terminated. Mistakes in this lifecycle can undermine an otherwise strong login.

What is the lifecycle of a session?

  1. Creation:
    The server creates a cryptographically random, unguessable identifier.
  2. Authentication:
    After login, the identifier is regenerated so a previously known value cannot continue.
  3. Use:
    Each request carries proof; the server checks validity, account status and authorization.
  4. Change:
    Password changes, MFA enrollment and privilege elevation renew or revoke relevant sessions.
  5. Expiry:
    Idle and absolute timeouts constrain the opportunity for abuse.
  6. Logout and revocation:
    Logout removes server-side state, while incident response can terminate every session for an account.

Transmitting cookies and tokens securely

Set-Cookie: session=RANDOM_OPAQUE_VALUE;
  Path=/; Secure; HttpOnly; SameSite=Lax

Secure restricts transmission to HTTPS, HttpOnly prevents direct JavaScript access and SameSite reduces certain cross-site requests. These attributes do not solve every problem: XSS can perform actions in an active session, and an unsuitable SameSite policy can break legitimate SSO flows. Session identifiers belong neither in URLs and logs nor in storage readable by application scripts.

Session cookie or self-contained token?

ModelAdvantageImportant limitation
Opaque session IDCentral validation and immediate revocation are straightforward.Requires an available session store and secure scaling.
JWT/self-contained tokenDistributed services can validate signed claims locally.Revocation, short lifetime, key rotation and claim validation require deliberate design.
Refresh and access tokenShort-lived access can be renewed without another interactive login.Refresh tokens are high-value and need rotation plus reuse detection.

Which session vulnerabilities are common?

With session fixation, an identifier known to the attacker remains valid after login. Session hijacking is the takeover of valid session proof through XSS, malware, logs or unsafe transport. Other mistakes include predictable IDs, missing expiry, incomplete logout, concurrent sessions without user visibility and permission changes that do not affect existing sessions.

How is session management tested?

  • Compare session IDs before and after login, MFA, role changes and password changes.
  • Inspect cookie attributes, Domain, Path and unintended transmission to subdomains.
  • Verify idle timeout, absolute lifetime, logout, password reset and administrative revocation.
  • Test concurrent devices, “remember me”, reuse of old tokens and refresh-token rotation.
  • Confirm that URLs, errors, analytics and logs never contain session proof.

What is a sound baseline?

Use maintained framework mechanisms instead of building a custom session system. Identifiers need adequate entropy, TLS and secure cookies. Lifetimes should reflect risk; particularly sensitive actions may require reauthentication. Users should be able to view active sessions and terminate one or all of them. Events such as new devices, unusual locations and failed token rotation belong in privacy-conscious security monitoring.

Penetration Tests

Uncover Security Vulnerabilities

Professional penetration testing for your business

Web Apps
Networks
Mobile Apps
10% New Customer Discount
Plan Now

Thank you for your feedback! We will review it and optimize this content.

Do you have feedback on Session Management? Tell us!