CVE-2024-56734
JSON

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 packageVersionsReported by
better-auth better-auth< 1.1.5CVE List
better-auth (npm)before 1.1.6GitHub Advisory Database
better-auth better_authbefore 1.1.6NVD

All scores

GitHub_M7.9high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-601

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

Related

Sources

SourceRecordLicence
CVE ListCVE-2024-56734 changed 2024-12-30CVE Terms of Use
GitHub Advisory DatabaseGHSA-8jhw-6pjj-8723 changed 2026-02-04CC-BY-4.0
NVDCVE-2024-56734 changed 2026-06-17Public domain