GitHub Advisoryadvisory · npm

GHSA-36rg-gfq2-3h56 Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes

LOW Published 2025-07-07 Modified 2025-07-07 Official page ↗
Aliases
CVE-2025-53535
Ecosystem
npm
Packages
better-auth
Severity
Low
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Weaknesses
CWE-601
Reviewed
2025-07-07

Affected packages

• npm better-auth: < 1.2.10 → fixed in 1.2.10

Description

Summary An open redirect has been found in the `originCheck` middleware function, which affects the following routes: `/verify-email`, `/reset-password/:token`, `/delete-user/callback`, `/magic-link/verify`, `/oauth-proxy-callback`. Details In the `matchesPattern` function, `url.startsWith(` can be deceived with a `url` that starts with one of the `trustedOrigins`. ```jsx const matchesPattern = (url: string, pattern: string): boolean => { if (url.startsWith("/")) { return false; } if (pattern.includes("*")) { return wildcardMatch(pattern)(getHost(url)); } return url.startsWith(pattern); }; ``` Open Redirect PoCs ```jsx export const auth = betterAuth({ baseURL: 'http://localhost:3000', trustedOrigins: [ "http://trusted.com" ], emailAndPassword: { ... }, }) ``` `/reset-password/:token` `/verify-email` `/delete-user/callback` `/magic-link/verify` `/oauth-proxy-callback` Impact Untrusted open redirects in various routes.

Related

Alias · CVE (1)

  • CVE-2025-53535 Better Auth is an authentication and authorization library for TypeScript. vulnerability

Weakness · CWE (1)

  • CWE-601 URL Redirection to Untrusted Site weakness

References