Details
The nonce binds an ID token to the browser session that requested it and is the control that prevents a token issued for one session being presented in another. Because the flag that governs this check is read from the token itself, the check can be disabled by the data it is applied to.
Who is impacted
OpenID Connect relying parties built on authlib's client integrations where an attacker can supply an ID token to parse_id_token():
- Implicit flow relying parties, where the ID token is returned in the URL fragment.
- Hybrid flow relying parties, where the ID token is returned in the fragment or by form post.
- Applications calling
parse_id_token()directly on externally supplied input.
Both the synchronous and asynchronous integrations are affected, so Flask, Django and Starlette deployments are equally exposed.
Relying parties using plain authorization code flow are not impacted, as the ID token is retrieved from the token endpoint over TLS following a state lookup and cannot be substituted by an attacker.
Consequence
An attacker in possession of a victim's ID token replays it into their own session. Nonce validation is skipped, parse_id_token() returns a UserInfo for the victim's subject, and the relying party establishes an authenticated session as the victim. This grants access to the victim's account at that relying party, including any data and actions available through it.
The token must carry a valid signature and pass iss and aud validation, so the vulnerability does not permit forging tokens or authenticating as an arbitrary subject. It removes the replay protection from a genuine token that has been captured, for example from browser history, a Referer header, proxy or server logs, or a shared device.
Mitigation available to integrators
None. The check is performed inside parse_id_token(), and no parameter or configuration option is exposed to disable the behaviour or to override the nonce handling.