PT-2025-7795 · Unknown · Better Auth
Shivaraj-Kolekar
+1
·
Published
2024-12-30
·
Updated
2025-02-28
·
CVE-2025-27143
CVSS v4.0
7.9
High
| Vector | AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H |
Name of the Vulnerable Software and Affected Versions
Better Auth versions prior to 1.1.21
Description
The application is vulnerable to an open redirect due to improper validation of the
callbackURL parameter in the email verification endpoint and any other endpoint that accepts a callback URL. While the server blocks fully qualified URLs, it incorrectly allows scheme-less URLs. This results in the browser interpreting the URL as a fully qualified URL, leading to unintended redirection. An attacker can exploit this flaw by crafting a malicious verification link and tricking users into clicking it. Upon successful email verification, the user will be automatically redirected to the attacker's website, which can be used for phishing, malware distribution, or stealing sensitive authentication tokens.Recommendations
Upgrade to Better Auth version 1.1.21 or later to enforce domain validation for
callbackURL for the /verify-email path and for all other GET endpoints.
As a temporary workaround, consider using hooks to pre-check URLs in your auth instance to prevent this without upgrading, by checking if the callbackURL is a trusted callback URL or not in the before hook.Exploit
Fix
Open Redirect
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Better Auth