Skip to content

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

Package

npm better-auth (npm)

Affected versions

>= 0.0.2, < 1.1.16

Patched versions

1.1.16

Description

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#L81

PoC

https://demo.better-auth.com/api/auth/error?error=%3Cscript%3Ealert(1)%3C/script%3E

image

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

@Bekacru Bekacru published to better-auth/better-auth Feb 5, 2025
Published to the GitHub Advisory Database Feb 5, 2025
Reviewed Feb 5, 2025
Last updated Feb 5, 2025

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

EPSS score

Weaknesses

CVE ID

No known CVE

GHSA ID

GHSA-9x4v-xfq5-m8x5

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.