Skip to main content

better-auth CVE-2026-67335

| EUVDEUVD-2026-51852 MEDIUM
Improper Authentication (CWE-287)
2026-08-01 VulnCheck GHSA-4hp3-gxv8-7g37
6.0
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify app with cookie state storage and pkce:false
  2. Delivery
    Authenticate with provider to obtain attacker-controlled code
  3. Exploit
    Lure victim to initiate OAuth login flow
  4. Execution
    Inject forged state and attacker code into victim's callback request
  5. Persist
    Server skips nonce comparison in parseGenericState
  6. Impact
    Session or account link minted for victim bound to attacker identity

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A07:2025 - Authentication Failures
ASVS 5.0
V6 - Authentication Authentication mechanism validation
MITRE ATT&CK

2 techniques across 2 tactics: Defense Evasion, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires all four of the following conditions to be simultaneously true: (1) the application runs better-auth at a version below 1.6.2; (2) the application explicitly sets betterAuth({ account: { storeStateStrategy: 'cookie' } }) - the default value 'database' is confirmed NOT affected, as database-backed state lookup enforces equality by key; (3) at least one OAuth provider is wired through genericOAuth({ config }) with pkce: false, or a custom getToken or tokenUrl is configured that does not require the stored codeVerifier in the token exchange - stock social providers with PKCE enabled are NOT affected; (4) the victim's browser holds a live oauth_state cookie, meaning the victim has initiated an OAuth login flow and the cookie has not yet expired, AND the identity provider accepts and returns an arbitrary code value to the callback endpoint. Limiting factors beyond the non-default configuration: the attacker must separately obtain a valid authorization code from the target provider (requiring their own provider account), and the victim must be socially engineered or redirected to complete the crafted callback request, making this a user-interaction-dependent attack per the CVSS 4.0 UI:P metric.

Impact

The CVSS 4.0 vector (AV:N/AC:H/AT:P/PR:N/UI:P/VI:H) and resulting score of 6.0 accurately reflect substantial real-world friction: high attack complexity, specific attack prerequisites (AT:P), and required user interaction all reduce practical exploitability. The critical limiting factor is that the vulnerability only manifests when the application explicitly sets storeStateStrategy: 'cookie' - a non-default value - AND disables PKCE on at least one OAuth provider. The default database-backed strategy is confirmed unaffected. No CISA KEV listing exists, and no public exploit code has been identified, suggesting exploitation has not been observed at scale. Despite this, organizations whose deployments do match the affected configuration face a high-integrity impact: a successful attack results in full OAuth session hijacking or persistent account linkage, both serious authentication compromises. The CVSS 4.0 score of 6.0 is reasonable and consistent with the constrained conditions; the EPSS score is not provided in the input data, so probability of near-term exploitation cannot be quantified. Priority action is a configuration audit: any deployment confirming both storeStateStrategy: 'cookie' and pkce: false on a generic OAuth provider should treat this as high urgency.

Exploit ScenarioDerived

An attacker targets a victim actively using an application that runs better-auth with storeStateStrategy: 'cookie' and a genericOAuth provider configured with pkce: false. After obtaining an attacker-controlled authorization code by authenticating with the same provider under their own account, the attacker delivers a crafted OAuth callback URL - via a phishing link, open redirect, or injected resource - that carries a forged state parameter and the attacker's code to /api/auth/oauth2/callback/<providerId> while the victim's browser still holds a live oauth_state cookie from their own sign-in initiation. Because parseGenericState does not compare the incoming state to the cookie's stored nonce, the server accepts the callback and mints a session in the victim's browser bound to the attacker's external identity, or links the attacker's provider account permanently to the victim's application profile.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Aug 01, 2026

OAuth state validation bypass in better-auth before 1.6.2 enables network-based attackers to forge the OAuth callback state parameter and supply attacker-controlled authorization codes, creating authenticated sessions in the victim's browser that are cryptographically bound to the attacker's external identity. Account-linking flows are equally exposed, permitting the attacker's provider account to be persistently linked to an authenticated victim row in the application's user store. Exploitation is constrained to a specific non-default configuration (cookie-backed state storage with PKCE disabled), and no public exploit has been identified at time of analysis.

RemediationAI

The primary remediation is to upgrade to better-auth 1.6.2 or later (current stable: 1.6.10) via npm install better-auth@latest; the patch was merged in PR #8949 (commit 9deb7936a) on 2026-04-09 and is confirmed fixed per the vendor advisory at https://github.com/better-auth/better-auth/security/advisories/GHSA-wxw3-q3m9-c3jr. For deployments that cannot immediately upgrade, the vendor documents two effective workarounds: first, switch betterAuth({ account: { storeStateStrategy } }) from 'cookie' back to the default value 'database', which is not affected because its state lookup is keyed by the state value itself - this requires the application's database to handle state table writes and may affect deployments in stateless or cookie-only environments; second, enable PKCE (pkce: true) on all OAuth providers configured via genericOAuth, which prevents an attacker-supplied code from completing the token exchange without the corresponding code verifier - this requires that all upstream providers support PKCE, which should be verified before enabling. Applying either workaround eliminates the attack path without a version upgrade, but upgrading remains the authoritative fix.

Affected VersionsENISA

better-auth 0 <1.6.2

Affected Packages

npm better-auth fix: 1.6.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

better-auth is an npm authentication library (CPE: cpe:2.3:a:better-auth:better-auth:*:*:*:*:*:*:*:*) that implements OAuth 2.0 social login, generic OAuth, OIDC SSO, and SAML relay flows. The defect (CWE-287: Improper Authentication) lives in parseGenericState, the shared primitive that validates the OAuth state parameter returned by identity providers at the authorization callback. The cookie-backed branch of that function decrypted the oauth_state cookie and verified its expiry but never compared the incoming state query parameter to the nonce that generateGenericState had embedded in the cookie at sign-in initiation. The database-backed path (the library default) was immune because its verification row is keyed by state value, making equality enforcement implicit in the lookup itself. The vulnerable code path affects every flow that passes through parseGenericState with cookie storage active: generic-oauth, social providers, account-link, oauth-proxy passthrough, OIDC SSO, and SAML relay state. The fix (PR #8949, commit 9deb7936a) writes oauthState: state into the encrypted cookie payload at generation time and rejects callbacks where parsedData.oauthState !== state.

Know when Better Auth gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 6.0 MEDIUM
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
vuln.today AI 5.3 MEDIUM

Network-delivered OAuth callback attack requiring non-default cookie config, user interaction to complete forged callback, and no confidentiality impact - only high integrity loss via session or account hijack.

3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
High
Attack Requirements
Present
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
High
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

1
Patch available
Aug 01, 2026 - 13:01 EUVD

DescriptionCVE.org

better-auth versions before 1.6.2 fail to validate the OAuth state parameter against the stored nonce when using cookie-backed state storage without PKCE. Attackers can forge the state parameter and supply an attacker-controlled authorization code to create authenticated sessions bound to the attacker's external identity or persistently link attacker accounts to victim profiles.

Threat Intelligence Overview

EPSS Score
0.2%
Top 93% exploitable
Prevalence
Medium
actively adopted npm auth library, growing but not yet ubiquitous
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.

CVE-2024-56734 HIGH POC
7.9 Dec 30

Better Auth is an authentication library for TypeScript. Rated high severity (CVSS 7.9), this vulnerability is remotely

CVE-2026-41427 HIGH POC
7.1 Apr 24

Authorization bypass in the @better-auth/oauth-provider plugin for Better Auth (versions >= 1.4.8-beta.7 and < 1.6.5, pl

CVE-2026-67330 CRITICAL
9.4 Aug 01

Privilege-escalating account takeover in the @better-auth/scim plugin (versions 1.4.0-beta.27 through 1.6.21 and 1.7.0-b

CVE-2026-67336 CRITICAL
9.4 Aug 01

Authentication bypass in Better Auth before 1.6.11 stems from insecure cryptographic defaults in the legacy oidcProvider

CVE-2025-71401 CRITICAL
9.3 Aug 02

Denial of service in Better Auth (npm) before 1.4.2 lets an unauthenticated remote attacker poison the router's base pat

CVE-2026-114607 CRITICAL
9.1 Oct 22

Unauthenticated OAuth state values can be redeemed as Magic Link tokens in Better Auth 1.4.0-beta.18 through 1.7.6, lett

CVE-2026-110864 CRITICAL
9.1 Oct 14

Authentication bypass in Better Auth's OAuth Proxy plugin (versions 1.5.0-beta.12 through 1.7.6) lets unauthenticated re

CVE-2025-71399 HIGH
8.8 Aug 02

Path normalization bypass in Better Auth before v1.4.5 allows unauthenticated remote attackers to circumvent `disabledPa

CVE-2026-67331 HIGH
8.7 Aug 01

Authorization bypass in @better-auth/scim versions 1.5.0 through 1.7.0-beta.3 allows any authenticated user to fully tak

CVE-2026-67327 HIGH
8.7 Aug 01

Pre-account hijacking in better-auth (npm) allows a remote attacker to gain persistent, password-based access to any vic

CVE-2026-67328 HIGH
8.6 Aug 01

Multiple authentication bypass vulnerabilities in @better-auth/sso before version 1.6.21 enable low-privileged attackers

CVE-2026-80192 HIGH
8.6 Aug 25

Two domain-ownership authentication bypass flaws in @better-auth/sso allow authenticated organization owners to compromi

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy