Session Hijacking

Cybersecurity Glossary Authentication & Access Control

Session Hijacking

An attack where the attacker steals or captures a valid session token through XSS, network sniffing, or other means to impersonate an authenticated user.

Session Hijacking is an attack where an attacker obtains a valid session token to impersonate an authenticated user. Once the session is compromised, the attacker gains full access to the victim's account.

Session Theft Methods

  • XSS: Steal cookies via JavaScript injection
  • Network sniffing: Capture unencrypted session cookies
  • Man-in-the-middle: Intercept session tokens in transit
  • Session prediction: Guess weak session IDs
  • Malware: Extract cookies from browser storage

Prevention

  • HttpOnly cookies: Prevent JavaScript access
  • Secure cookies: Only send over HTTPS
  • SameSite cookies: Prevent cross-site sending
  • Session timeouts: Limit validity window
  • Re-authentication: Require password for sensitive actions
  • Session binding: Tie to IP or device fingerprint

See Also