CVE-2024-56734: Better auth Better Auth Has An Open Vulnerability
HIGHCVE-2024-56734 is a HIGH better auth has an open vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Better auth libraries in the npm ecosystem. The issue involves better auth has an open redirect vulnerability in verify email endpoint. Remediation is available by upgrading affected packages to version 1.1.6.
CVE-2024-56734 at a Glance
How to Fix CVE-2024-56734
To remediate this vulnerability, upgrade all affected Better auth dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install better-auth@1.1.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls better-auth
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-56734, inspect your project dependencies using npm:
npm ls better-auth
Analyze the terminal output to locate any version of Better auth in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.6), your application is affected.
Note: The npm ls better-auth command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Better auth, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-56734 Affected Better auth Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
better-auth
|
npm |
< 1.1.6
|
1.1.6
|
References
Frequently Asked Questions
What is CVE-2024-56734?
Which Better auth versions are affected?
What version fixes CVE-2024-56734?
Is better-auth affected?
What CWE is associated with CVE-2024-56734?
How can I check npm dependencies for CVE-2024-56734?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-8jhw-6pjj-8723",
"modified" : "2024-12-30T18:45:17Z",
"published" : "2024-12-30T16:49:12Z",
"aliases" : [ "CVE-2024-56734" ],
"summary" : "Better Auth has an Open Redirect Vulnerability in Verify Email Endpoint",
"details" : "## Summary\nAn **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.\n\n## Affected Versions\n- All versions prior to **v1.1.6**.\n\n## Impact\nAttackers could craft malicious email verification links that exploit the redirect functionality to send users to untrusted domains. This can result in:\n\n- **Phishing attacks** – Users may unknowingly enter sensitive information on fake login pages.\n- **Reputation damage** – Trust issues for applications using Better Auth.\n\n## Vulnerability Details\nThe 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.\n\n**Example Exploit:**\n```\nhttps://example.com/auth/verify-email?token=abcd1234&callbackURL=https://malicious-site.com\n```\n\n## Patches\nUpgrade 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.\n\n## Workarounds\nYou can also use hooks to pre-check URLs in your auth instance to prevent this without upgrading:\n\n```ts\nconst auth = betterAuth({\n hooks: {\n before: (ctx) => {\n if (ctx.path === \"/verify-email\") {\n const callbackURL = ctx.query.callbackURL; // Check if this is a trusted callback URL or not\n }\n }\n }\n})\n```",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "better-auth"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.1.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/better-auth/better-auth/security/advisories/GHSA-8jhw-6pjj-8723"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-56734"
}, {
"type" : "WEB",
"url" : "https://github.com/better-auth/better-auth/commit/deb3d73aea90d0468d92723f4511542b593e522f"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/better-auth/better-auth"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-601" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-30T16:49:12Z",
"nvd_published_at" : "2024-12-30T17:15:10Z"
}
}