7.9high
Better Auth has an Open Redirect Vulnerability in Verify Email Endpoint
- Severity
- 7.9high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.39% (higher than 34% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-8jhw-6pjj-8723
Description
Better Auth is an authentication library for TypeScript. An open redirect vulnerability has been identified in the verify email endpoint of all versions of Better Auth prior to v1.1.6, 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. Version 1.1.6 contains a patch for the issue.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| better-auth better-auth | < 1.1.5 | CVE List |
| better-auth (npm) | before 1.1.6 | GitHub Advisory Database |
| better-auth better_auth | before 1.1.6 | NVD |
All scores
| GitHub_M | 7.9high CVSS:4.0 | 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 |
| GitHub | high CVSS:4.0 | 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 |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Better Auth is an authentication library for TypeScript. An open redirect vulnerability has been identified in the verify email endpoint of all versions of Better Auth prior to v1.1.6, 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. Version 1.1.6 contains a patch for the issue.
GitHub Advisory Database
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.
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.
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
Patches
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.
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
}
}
}
})
NVD (es)
Better Auth es una librería de autenticación para TypeScript. Se ha identificado una vulnerabilidad de redirección abierta en el endpoint de verificación de correo electrónico de todas las versiones de Better Auth anteriores a la v1.1.6, lo que potencialmente permite a los atacantes redirigir a los usuarios a sitios web maliciosos. Este problema afecta a los usuarios que dependen de los enlaces de verificación de correo electrónico generados por la librería. El endpoint de devolución de llamada de verificación de correo electrónico acepta un parámetro `callbackURL`. A diferencia de otros métodos de verificación, la verificación de correo electrónico solo utiliza JWT para verificar y redirigir sin la validación adecuada del dominio de destino. El verificador de origen se omite en este escenario porque solo verifica las solicitudes `POST`. Un atacante puede manipular este parámetro para redirigir a los usuarios a URL arbitrarias controladas por el atacante. La versión 1.1.6 contiene un parche para el problema.
References
| https://github.com/better-auth/better-auth/security/advisories/GHSA-8jhw-6pjj-8723 | exploit, mitigation, vendor-advisory, web | |
| https://github.com/better-auth/better-auth/commit/deb3d73aea90d0468d92723f4511542b593e522f | patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2024-56734 | advisory | |
| https://github.com/better-auth/better-auth | package | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-56734 changed 2024-12-30 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-8jhw-6pjj-8723 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2024-56734 changed 2026-06-17 | Public domain |