Summary
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.
Affected Versions
- All versions prior to v1.1.6.
Vulnerability Details
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.
Example Exploit:
https://example.com/auth/verify-email?token=abcd1234&callbackURL=https://malicious-site.com
Workarounds
You can also use hooks to pre-check URLs in your auth instance to prevent this without upgrading:
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
}
}
}
})
Impact
Attackers could craft malicious email verification links that exploit the redirect functionality to send users to untrusted domains. This can result in:
- Phishing attacks, Users may unknowingly enter sensitive information on fake login pages.
- Reputation damage, Trust issues for applications using Better Auth.
Untrusted input controls a URL used for redirection, which can forward users to attacker-controlled sites. Typical impact: phishing and credential harvesting via a trusted domain.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Upgrade to Better Auth v1.1.6 or later. This version enforces domain validation for callbackURL for /verify-email path and for all other GET endpoints.
Frequently Asked Questions
- What is CVE-2024-56734? CVE-2024-56734 is a high-severity open redirect vulnerability in better-auth (npm), affecting versions < 1.1.6. It is fixed in 1.1.6. Untrusted input controls a URL used for redirection, which can forward users to attacker-controlled sites.
- Which versions of better-auth are affected by CVE-2024-56734? better-auth (npm) versions < 1.1.6 is affected.
- Is there a fix for CVE-2024-56734? Yes. CVE-2024-56734 is fixed in 1.1.6. Upgrade to this version or later.
- Is CVE-2024-56734 exploitable, and should I be worried? Whether CVE-2024-56734 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-56734 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-56734? Upgrade
better-authto 1.1.6 or later.