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
- Upgrade to the fixed version: run
npm install better-auth@1.6.13(first patched version 1.6.13). [1] - Upgrade to
better-auth@1.6.13(stable) or1.7.0-beta.4(pre-release). [1] - Before navigating, parse the returned value and navigate only when its scheme is
http:orhttps:. [1] - Migrate to
@better-auth/oauth-provider. [1] - Keep
allowDynamicClientRegistrationat its default offalseand 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.
What happened
- The deprecated
oidc-providerplugin registers OAuth clients without validating the scheme of theirredirect_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
mcpplugin 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
Sources
- 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.
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-authCorrections
Report an error or request a correction. We review requests within 5 business days and add a dated correction note.
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.