Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. better-auth
  4. ›
  5. GHSA-wxw3-q3m9-c3jr

GHSA-wxw3-q3m9-c3jr: Better Auth: OAuth callback accepts mismatched `state` when cookie-backed state storage is used without PKCE

May 15, 2026

In parseGenericState, the cookie branch decrypted the oauth_state cookie and validated expiry, but did not compare the incoming OAuth state query parameter to the nonce that generateGenericState issued at sign-in. Any callback to /api/auth/oauth2/callback/<providerId> that arrived with a forged state and any code was therefore accepted as long as the browser still held a live oauth_state cookie. With pkce: false (or any getToken path that does not enforce a code-verifier round-trip), an attacker who forced the victim to deliver an attacker-controlled authorization code to the callback would mint a session bound to the attacker’s external identity in the victim’s browser. Account-linking flows behaved the same way, binding the attacker’s external account to an authenticated victim row.

References

  • github.com/advisories/GHSA-wxw3-q3m9-c3jr
  • github.com/better-auth/better-auth/commit/9deb7936aba7931f2db4b460141f476508f11bfd
  • github.com/better-auth/better-auth/issues/8897
  • github.com/better-auth/better-auth/pull/8949
  • github.com/better-auth/better-auth/security/advisories/GHSA-wxw3-q3m9-c3jr

Code Behaviors & Features

Detect and mitigate GHSA-wxw3-q3m9-c3jr with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 1.6.2

Fixed versions

  • 1.6.2

Solution

Upgrade to version 1.6.2 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-287: Improper Authentication
  • CWE-345: Insufficient Verification of Data Authenticity
  • CWE-352: Cross-Site Request Forgery (CSRF)

Source file

npm/better-auth/GHSA-wxw3-q3m9-c3jr.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:13 +0000.