Better Auth URL parameter HTML Injection (Reflected Cross-Site scripting)
Critical severity
GitHub Reviewed
Published
Feb 5, 2025
in
better-auth/better-auth
•
Updated Feb 5, 2025
Description
Published to the GitHub Advisory Database
Feb 5, 2025
Reviewed
Feb 5, 2025
Last updated
Feb 5, 2025
Summary
The better-auth
/api/auth/error
page was vulnerable to HTML injection, resulting in a reflected cross-site scripting (XSS) vulnerability.Details
The value of
error
URL parameter was reflected as HTML on the error page: https://github.com/better-auth/better-auth/blob/05ada0b79dbcac93cc04ceb79b23ca598d07830c/packages/better-auth/src/api/routes/error.ts#L81PoC
https://demo.better-auth.com/api/auth/error?error=%3Cscript%3Ealert(1)%3C/script%3E
Impact
An attacker who exploited this vulnerability by coercing a user to visit a specially-crafted URL could execute arbitrary JavaScript in the context of the user's browser.
Because better-auth is a dependency of web applications, the impact of such a vulnerability is unknowable; it depends on the functionality of the application/site using better-auth. I have calculated the CVSS score assuming the hypothetical victim is an administrator with elevated permissions and access.
References