Single Sign-On (SSO) attacks
TL;DR: SAML + OAuth + OIDC trust-chain failures: confused-deputy, audience mismatch, account-linking races.
What it is
SSO offloads authentication to an IdP. The bug class is the trust chain — IdP, broker, SP, and account-linking logic all have to agree on identity. When any two disagree, an attacker who controls one identity at the IdP can claim another at the SP, or vice-versa. SSO bugs typically yield account takeover with no password.
Preconditions / where it applies
- App accepts SSO via SAML / OAuth / OIDC, possibly multiple providers
- Account-linking logic that matches federated identity to local user by email, sub, or claim
- IdP and SP not strictly bound (audience, issuer, redirect URI loose)
Technique
- Email-claim trust without verification — attacker registers IdP with
email_verified=falseor controls an IdP that lets them set any email; SP links to local user by email. Classic Google Workspace + custom-domain bug. Sign upvictim@corp.comat attacker IdP, log in to SP as victim. - OIDC
audmismatch — token issued for client A accepted by client B; cross-app pivot. See jwt. - OAuth
redirect_uriopen allowlist —redirect_uri=https://attacker.tldaccepted, code leaks. See oauth-flows. - OAuth
statenot bound to session — login CSRF: attacker initiates auth, victim completes; attacker is now logged into victim’s app session. - SAML XSW / NameID swap — replay or wrap a signed assertion; see saml-attacks.
- Provider confusion — SP supports both “Login with Google” and “Login with Microsoft”; both expose
subclaims that overlap (numeric ids). If linking uses onlysub, attacker logs in as Microsoft user with a Googlesubthat collides. - Account-linking race — register victim’s email at SP; victim signs up via IdP and is auto-linked to attacker’s pre-existing account, granting attacker their session.
- Pre-account hijack — attacker creates pending account
victim@corp.com; victim later does SSO; SP merges accounts, attacker retains session cookie set at hijack time. logout_uriopen redirect / token leak via Referer.- PKCE downgrade — server accepts code flow without PKCE for “legacy” clients; intercept code via mv3-extension-bypass or malicious app.
- Cross-IdP recovery — disabling one IdP via takeover lets attacker bind their own as primary.
Detection and defence
- Always require
email_verified=true(OIDC) or equivalent IdP assurance before linking to a local account; otherwise force out-of-band verification. - Strict
redirect_uriexact-match allowlist; sign thestate; bind PKCE per session. - Validate
iss,aud,azp,nonce,at_hash,exp,iaton every token. - Tie SSO identity to a tuple
(issuer, sub)notemailalone; never trust email as a primary key across providers. - Disable account-merge by email; require manual confirmation.
- Audit IdP allowlist; disable unused providers.
- Related: saml-attacks, oauth-flows, oauth-token-theft, jwt, webauthn-api-hijacking-downgrade.
References
- Detectify — pre-account hijack — Microsoft research overview
- PortSwigger — OAuth — flow attacks
- Cloud Native Computing — SSO security model — OAuth threat model RFC