Summary
Vaultwarden's SSO authorization flow failed to properly bind the OAuth state parameter and allowed attacker-controlled PKCE data, breaking the integrity of the login process.
Under these conditions, an unauthenticated attacker could drive an unsuspecting user through IdP authentication and then redeem tokens for a fully authenticated Vaultwarden session.
Affected context
This vulnerability occurs in deployments using Vaultwarden's SSO/OAuth-based login flow, particularly where users authenticate through an external Identity Provider (IdP).
It becomes relevant when browsers can be coerced into following authorization links or auto-submitting SSO requests without strong binding between the OAuth state and the initiating session.
Environments that rely heavily on SSO for administrative or privileged accounts are especially exposed if PKCE and state validation are not strictly enforced.
Exploit preconditions
- Attack surface: Web-based SSO endpoints, especially
/connect/authorizeand token exchange routes. - Required access: Ability to get a victim to visit or automatically trigger crafted SSO URLs (e.g., via phishing, malicious links, or embedded content).
- Trigger point: The victim's browser follows the attacker-crafted authorization request, causing the IdP to authenticate and issue tokens.
- Why exploitation is possible:
- The OAuth
stateparameter is not bound to the initiating browser session, so responses can be associated with attacker-driven flows. - PKCE parameters are attacker-controlled, allowing misuse of the code exchange.
SsoAuthrecords can persist after failed token exchanges, enabling reuse or manipulation to complete an unauthorized authenticated session.
Why this happens
The underlying bug class is improper enforcement of cross-request integrity in an OAuth-based SSO flow, corresponding to CWE-352: Cross-Site Request Forgery (CSRF).
The server trusts incoming authorization and token requests without robust linkage to the original user session and without constraining PKCE parameters to trusted values.
As a result, the SSO mechanism treats attacker-orchestrated requests as legitimate, allowing authentication state and access tokens to be issued and consumed by an attacker-controlled context.
Conceptually, the pattern is: sensitive state-changing authentication operations are exposed through endpoints that lack strong anti-forgery guarantees such as bound state values, session correlation, and one-time use records.
Potential impact
- An attacker may obtain a fully authenticated Vaultwarden session tied to the victim's account.
- Attackers could access, modify, or delete stored secrets and vault items.
- Administrative or high-privilege accounts could be taken over, impacting configuration and other users.
- Users' perception of SSO trust could be undermined, potentially affecting broader IdP-integrated ecosystems.
General mitigation guidance
Effective mitigation focuses on ensuring strong integrity guarantees for every step in the SSO/OAuth flow, especially where authentication state changes.
Recommended patterns include:
- Binding the OAuth
stateparameter to the initiating browser session and validating it strictly for each callback. - Restricting and validating PKCE parameters server-side, ensuring they cannot be attacker-controlled beyond defined, secure patterns.
- Treating intermediate authentication records (such as
SsoAuthentries) as one-time artifacts that are invalidated immediately on failure or completion. - Implementing robust CSRF protections for SSO endpoints, including session-tied nonces and explicit user interaction where appropriate.
- Applying least-privilege principles to authenticated sessions and reducing the blast radius of any single account compromise (e.g., scoped tokens, role separation).
How teams detect issues like this
Detection typically involves a combination of design review and runtime observation:
- Static and design analysis: Review SSO and OAuth implementations to ensure
stateand PKCE are tightly coupled to user sessions and not derived from untrusted input. - Code review signals: Look for authorization endpoints that accept parameters without correlating them to server-side session data; examine how intermediate auth records are created, validated, and invalidated.
- Automated checks: Use security-focused linters or application security testing tools that understand OAuth/PKCE patterns to flag workflows lacking CSRF-style protections.
- Logging and monitoring: Monitor SSO endpoints for unusual patterns such as repeated authorization attempts from the same IP using varied
stateor PKCE values, or re-use of token exchange artifacts. - Policy enforcement: Adopt internal development policies requiring formal threat models for authentication flows and mandatory security review before changes to SSO/OAuth components are deployed.

