Definition
Session Fixation
Session fixation is a full-session hijack that becomes possible when an attacker can violate the integrity of the victim’s cookies — the typical setting is a same-site attacker — and the application does not refresh the session id on login.
- The attacker visits
bank.comand receives a pre-auth session ids_atk.- The victim visits
evil.bank.com, which setsSet-Cookie: sid=s_atk; domain=bank.comin the victim’s browser.- The victim logs in to
bank.com. Domain cookies are attached, sos_atkis sent and promoted to the victim’s authenticated session identifier.- The attacker, who knows
s_atk, can now use the victim’s authenticated session.
Fix
Rotate the session identifier on every privilege change — in particular on successful login. A fresh id at login defeats fixation regardless of how the old id was planted.