Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker crafts malicious /api/auth/error URL
-
DeliveryDelivers link to victim via phishing or redirect
-
ExploitVictim clicks link, browser requests the crafted URL
-
Executionbetter-auth reflects unsanitized 'error' parameter as HTML
-
PersistInjected JavaScript executes in victim's browser session
-
ImpactAttacker exfiltrates session cookies or credentials
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the target application is running better-auth version 0.0.2 through 1.1.15 and that the /api/auth/error route is reachable by a potential victim - this route is part of better-auth's default configuration and is not optional. The attacker must also coerce the victim into visiting a specially crafted URL (UI:A in CVSS 4.0), typically via phishing, QR code, or a redirect chain. No authentication is required from the attacker side (PR:N). The critical limiting factor is the mandatory user-interaction step: automated exploitation without victim participation is not possible for this reflected XSS class. Exploitation is further bounded by the victim's session and browser context - it does not affect other users or the server itself. Attacks against applications that sit behind SSO or that do not expose the /api/auth/error route publicly face a reduced but non-zero attack surface via authenticated users being redirected. |
| Impact | The CVSS 4.0 score of 5.1 (Medium) accurately captures the real-world risk profile: the UI:A metric is the decisive limiting factor, as exploitation is gated entirely on a victim clicking or being redirected to an attacker-controlled URL. Impact metrics VC:L/VI:L reflect the bounded but real consequences - session cookie theft, credential harvesting via fake login forms, and UI redressing are all plausible within the victim's browser session. The vulnerability is not listed in CISA KEV and no public exploit code has been confirmed, making opportunistic mass exploitation unlikely at present. EPSS data was not provided in the source intelligence. The absence of attack requirements (AT:N, AC:L) means that once a victim visits the URL, exploitation is reliable with no race condition or complex setup. The primary risk vector is targeted phishing using a legitimate-looking better-auth-hosted URL, which lends the attack inherent credibility. Overall, this is a genuine medium-priority finding: low barrier for a motivated attacker but limited blast radius without chaining to a follow-on attack such as session hijacking. |
| Exploit ScenarioDerived | An attacker crafts a URL such as https://target-app.com/api/auth/error?error=%3Cscript%3Ealert(document.cookie)%3C/script%3E and delivers it to a victim via phishing email or malicious link, exploiting the legitimacy of the target application's own domain to bypass suspicion. When the victim clicks the link, better-auth reflects the unsanitized payload into the HTML response and the victim's browser executes the injected JavaScript within the application's origin. No public proof-of-concept has been identified at time of analysis, but the vulnerability class is trivially reproducible given knowledge of the affected endpoint. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Aug 01, 2026
Reflected XSS in better-auth's /api/auth/error endpoint enables arbitrary JavaScript execution in a victim's browser when a user visits an attacker-crafted URL containing a malicious 'error' query parameter that is reflected as unsanitized HTML. All npm releases of better-auth from version 0.0.2 up to (but not including) 1.1.16 are affected, spanning virtually the entire release history of the library. No public exploit code has been identified at time of analysis and the vulnerability is not listed in CISA KEV; however, the attack surface is inherently internet-accessible and requires only social engineering to trigger.
RemediationAI
Upgrade the better-auth npm package to version 1.1.16, which is the vendor-confirmed fix version per both GHSA-9x4v-xfq5-m8x5 and ENISA EUVD-2025-210583. The patch is available at https://github.com/better-auth/better-auth/commit/7ae340e2eddad641b7e43d24d37c58a66ce9ddcf. If an immediate upgrade is not feasible, a compensating control is to place a Web Application Firewall rule or reverse proxy filter that strips or encodes angle brackets and script-injection sequences from the 'error' query parameter on requests to /api/auth/error; note this trades off completeness of error messaging and may require ongoing maintenance as bypass techniques evolve. Blocking direct external access to the /api/auth/error path entirely is a more robust workaround where the authentication error page is not required for external users, at the cost of degraded error UX.
Affected VersionsENISA
Affected Packages
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 framework (cpe:2.3:a:better-auth:better-auth:*:*:*:*:*:*:*:*) that exposes a built-in /api/auth/error HTTP route for surfacing authentication errors to end users. Per GHSA-9x4v-xfq5-m8x5, the vulnerable code at packages/better-auth/src/api/routes/error.ts line 81 interpolates the raw value of the 'error' URL query parameter directly into the HTML response without encoding or sanitization, satisfying CWE-79 (Improper Neutralization of Input During Web Page Generation). Because the parameter is server-reflected rather than stored, the payload is not persisted and must be delivered fresh with each victim request - the classic reflected XSS pattern. The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:A) confirms that no special network position or attack prerequisite is needed beyond inducing a user to follow a link.
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
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
Network-accessible with no privileges needed; scope changes as injected JS executes in victim browser context; user interaction required to click the crafted link.
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
DescriptionCVE.org
better-auth versions after v0.0.2 and before 1.1.16 contain a reflected cross-site scripting (XSS) vulnerability on the /api/auth/error page, where the value of the 'error' URL parameter is reflected as HTML without proper neutralization. An attacker who coerces a user into visiting a specially-crafted URL can execute arbitrary JavaScript in the context of the user's browser. The issue is fixed in version 1.1.16.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
More in Better Auth
View allBetter Auth is an authentication library for TypeScript. Rated high severity (CVSS 7.9), this vulnerability is remotely
Authorization bypass in the @better-auth/oauth-provider plugin for Better Auth (versions >= 1.4.8-beta.7 and < 1.6.5, pl
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
Authentication bypass in Better Auth before 1.6.11 stems from insecure cryptographic defaults in the legacy oidcProvider
Denial of service in Better Auth (npm) before 1.4.2 lets an unauthenticated remote attacker poison the router's base pat
Unauthenticated OAuth state values can be redeemed as Magic Link tokens in Better Auth 1.4.0-beta.18 through 1.7.6, lett
Authentication bypass in Better Auth's OAuth Proxy plugin (versions 1.5.0-beta.12 through 1.7.6) lets unauthenticated re
Path normalization bypass in Better Auth before v1.4.5 allows unauthenticated remote attackers to circumvent `disabledPa
Authorization bypass in @better-auth/scim versions 1.5.0 through 1.7.0-beta.3 allows any authenticated user to fully tak
Pre-account hijacking in better-auth (npm) allows a remote attacker to gain persistent, password-based access to any vic
Multiple authentication bypass vulnerabilities in @better-auth/sso before version 1.6.21 enable low-privileged attackers
Two domain-ownership authentication bypass flaws in @better-auth/sso allow authenticated organization owners to compromi
EUVD-2025-210583
GHSA-ch2q-47vm-cxgf
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB