PT-2024-37047 · Unknown · Better Auth
Jamesjulich
·
Published
2024-12-30
·
Updated
2025-10-20
·
CVE-2024-56734
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 v1.1.6
Description
An open redirect vulnerability has been identified in the verify email endpoint of Better Auth, potentially allowing attackers to redirect users to malicious websites. This issue affects users relying on email verification links generated by the library. The verify email callback endpoint accepts a
callbackURL parameter. Unlike other verification methods, email verification only uses JWT to verify and redirect without proper validation of the target domain. The origin checker is bypassed in this scenario because it only checks for POST requests. An attacker can manipulate this parameter to redirect users to arbitrary URLs controlled by the attacker.Recommendations
For versions prior to v1.1.6, upgrade to Better Auth v1.1.6 or later, which enforces 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. For example:const auth = betterAuth({
hooks: {
before: (ctx) => {
if (ctx.path === "/verify-email") {
const callbackURL = ctx.query.callbackURL; // Check if this is a trusted callback URL or not
}
}
}
})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