/

CVE-2026-47158

Severity:

HIGH RISK

(8.3)

SSO CSRF (CWE-352) in Vaultwarden OAuth Flow

CVE-2026-47158

Deferred

Vulnerability type

Category:

Cross-Site Request Forgery (CSRF)

CWE:

CWE-352

Impact:

Account Takeover via Forged SSO Authorization

Severity:

HIGH RISK

(8.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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/authorize and 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 state parameter 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.
  • SsoAuth records 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 state parameter 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 SsoAuth entries) 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 state and 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 state or 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.

Sources

SourceLink
github.comgithub.com/dani-garcia/vaultwarden/commit/d297e274a35dccd0f5d935e9d5934e0f7e9c0a87
github.comgithub.com/dani-garcia/vaultwarden/pull/7163
github.comgithub.com/dani-garcia/vaultwarden/releases/tag/1.36.0
github.comgithub.com/dani-garcia/vaultwarden/security/advisories/GHSA-pfp2-jhgq-6hg5

Frequently asked

questions

It can be exploited wherever users rely on Vaultwarden's SSO flow and can be induced to follow attacker-crafted SSO links. The attacker does not need prior authentication in Vaultwarden but typically relies on the victim's ability to authenticate with the IdP.

The attacker needs only the capability to deliver malicious authorization requests to victims (e.g., via email, chat, injected links, or web pages). They do not need direct access to Vaultwarden or the IdP; they leverage the victim's browser and existing IdP credentials.

The robust fix pattern is to enforce strict binding between OAuth requests and user sessions, guarantee one-time use of authentication artifacts, and validate PKCE and state values as trusted, session-derived data. All SSO authentication transitions should be treated as sensitive state changes requiring strong anti-forgery protections.

Start with a clear threat model for OAuth/SSO flows, adopt well-vetted frameworks or libraries that handle state, PKCE, and CSRF automatically, and mandate security reviews for authentication-related code. Consistently enforce session-bound nonces, strict parameter validation, short-lived tokens, and comprehensive logging for all SSO endpoints.

Find out what's already
exploitable in your codebase.