NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2025-53535: Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes

lowCVSS 4.0 2.1GHSA-36rg-gfq2-3h56

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.

Published Jul 7, 2025

Affected packages

better-auth

Ecosystem
npm
Affected
<= 1.2.9
Fixed in
1.2.10
Check
npm ls better-auth

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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.

		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

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.

Credited to mwlik, imenyoo2.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More npm vulnerabilities

All npm entries