An attack where an attacker forces a victim to use a known OAuth2 state value, enabling the attacker to complete the OAuth flow on behalf of the victim.
OAuth2 State Fixation is an attack where the attacker forces a victim to use a pre-set state value that the attacker knows. This allows the attacker to link their OAuth account to the victim's session or bypass CSRF protections.
// 1. Attacker visits vulnerable app, gets state
GET /login/oauth?provider=github
// App generates: state=ATTACKER_KNOWN_STATE
// 2. Attacker creates malicious link for victim
https://victim-app.com/oauth/callback?
code=ATTACKER_AUTH_CODE&
state=ATTACKER_KNOWN_STATE
// 3. If app doesn't properly bind state to session,
// victim's account gets linked to attacker's GitHub