High (AgentArmorHQ estimate)Code execution

Better Auth has stored XSS in the auth-server origin via javascript: redirect_uri in oidc-provider and mcp

Product
better-auth
Affected
better-auth 1.6.12 and earlier, and 1.7.0-beta.0 to 1.7.0-beta.3
Fixed in
1.6.13 (stable) and 1.7.0-beta.4 (pre-release)

Last verified against sources: October 26, 2026

Am I affected?

better-auth: affected better-auth 1.6.12 and earlier, and 1.7.0-beta.0 to 1.7.0-beta.3. Fixed in 1.6.13 (stable) and 1.7.0-beta.4 (pre-release).

  • Check your version: run npm ls better-auth. Versions < 1.6.13 of better-auth are affected. [1]

What to do now

  1. Upgrade to the fixed version: run npm install better-auth@1.6.13 (first patched version 1.6.13). [1]
  2. Upgrade to better-auth@1.6.13 (stable) or 1.7.0-beta.4 (pre-release). [1]
  3. Before navigating, parse the returned value and navigate only when its scheme is http: or https:. [1]
  4. Migrate to @better-auth/oauth-provider. [1]
  5. Keep allowDynamicClientRegistration at its default of false and restrict who can register clients. [1]

General practice, not from the source: if the affected software could read tokens or credentials, rotate them after upgrading; pin versions and review changes before updating tools your agents run.

Discuss this incident

What happened

  • The deprecated oidc-provider plugin registers OAuth clients without validating the scheme of their redirect_uris. [1]
  • An attacker stores a javascript: URI as a client redirect target, and the authorization server later returns that URI to the browser in the consent response. [1]
  • The mcp plugin wraps the same provider and carries the same defect, so MCP server deployments are affected as well. [1]

Impact

  • A consent page that navigates to the returned value then executes attacker JavaScript in the authorization-server origin, which exposes the victim's session and enables account takeover. [1]
  • From there the script reads /api/auth/get-session, calls any session-scoped endpoint, and takes over the account. [1]
  • The consent screen shows the attacker-controlled client name, which makes the approval click easy to socially engineer. [1]

What was done

  • Fixed in better-auth@1.6.13 (stable) and 1.7.0-beta.4 (pre-release). [1]
  • The fix adds scheme validation to the redirect_uris of both the oidc-provider and mcp plugins, matching the control @better-auth/oauth-provider already enforces. [1]

Sources

  1. GHSA-86j7-9j95-vpqj — GitHub Advisory Database

Every statement above was checked against these sources before publishing. Spotted an error? Tell us and we will correct it with a dated note.

Share advisory brief with your team

Copy a plain-text summary for Slack, GitHub issues, or team security channels.

Brief
Better Auth has stored XSS in the auth-server origin via javascript: redirect_uri in oidc-provider and mcp
Product: better-auth | Affected: better-auth 1.6.12 and earlier, and 1.7.0-beta.0 to 1.7.0-beta.3 | Fixed in: 1.6.13 (stable) and 1.7.0-beta.4 (pre-release)
Summary: The deprecated `oidc-provider` plugin registers OAuth clients without validating the scheme of their `redirect_uris`.
Source & remediation on AgentArmorHQ: https://agentarmorhq.com/incidents/2026/07/ghsa-86j7-9j95-vpqj-better-auth
Was this page useful?

Corrections

Report an error or request a correction. We review requests within 5 business days and add a dated correction note.

10 to 2,000 characters. A link to a source helps. Stored as plain text.

Discussions for better-auth

Ask questions or share configuration tips. Governed by our Community Rules & Terms.

No posts match this filter yet.

Be the first to ask a question or share a working tip.

Check before you install

Paste a package name or a GitHub link and get a clear answer in seconds: Block, Review or No known issues. No account needed.

Check a package

Questions? Contact us