Low

Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes

  • Disclosed: 07.07.2025
  • Updated: 11.10.2026 10:22

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.

js
		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

js
export const auth = betterAuth({
	baseURL: 'http://localhost:3000',
	trustedOrigins: [
		"http://trusted.com"
	],
	emailAndPassword: {
		...
	},
})

/reset-password/:token

<img width="481" alt="image" src="https://github.com/user-attachments/assets/46e7871a-1dad-4375-af94-0446e29aaab6" /> <br/> <img width="518" alt="image 1" src="https://github.com/user-attachments/assets/83abfb53-6fc9-4d1f-918d-9b4ce093c808" />

/verify-email

<img width="549" alt="image" src="https://github.com/user-attachments/assets/7dd424b7-42a4-4616-aa73-fcc2e3eeb309" /> <br/> <img width="436" alt="image" src="https://github.com/user-attachments/assets/54f11636-0a3e-4e83-9a09-57c5e8ba98cd" />

/delete-user/callback

<img width="545" alt="image" src="https://github.com/user-attachments/assets/2ff1b217-d069-48fb-81c1-f8c8792d34a4" /> <br/> <img width="492" alt="image" src="https://github.com/user-attachments/assets/71df11db-9d38-4f34-abe1-add9d60b3486" />

/magic-link/verify

<img width="379" alt="image" src="https://github.com/user-attachments/assets/6b6b6a8a-59b6-4a65-9df3-57d5b2f6eb0f" /> <br/> <img width="413" alt="image" src="https://github.com/user-attachments/assets/82a5c9c6-2ea0-44eb-af48-40732657b59e" />

/oauth-proxy-callback

<img width="548" alt="image" src="https://github.com/user-attachments/assets/d8d2ee51-e9fd-4337-bec3-a70afd1ceacb" /> <br/> <img width="544" alt="image" src="https://github.com/user-attachments/assets/f097d406-b965-4f85-b124-9b0ef1cc2689" />

Impact

Untrusted open redirects in various routes.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package better-auth < 1.2.10 1.2.10

References

CVSS score -
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
Weakness (CWE)
CWE-601
Platform
npm
Package
better-auth
Disclosed
07.07.2025
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-36rg-gfq2-3h56 - CC BY 4.0

Vulnerability history: better-auth

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (22) in the archive
Total entries
22
First → latest
12.2024 07.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 2
  • High 14
  • Medium 3
  • Low 3

Disclosures per year

  1. 2024: 1
  2. 2025: 8
  3. 2026: 13
Severity:
  1. High · 8.3 CVE-2026-67327 >= 1.1.3, < 1.6.22, >= 1.7.0-beta.0, < 1.7.0-beta.10 1.6.22, 1.7.0-beta.10
  2. High · 8.1 CVE-2026-53517 >= 1.4.8-beta.7, < 1.6.0 1.6.0
  3. High · 7.7 CVE-2026-67333 < 1.6.13, >= 1.7.0-beta.0, < 1.7.0-beta.4 1.6.13, 1.7.0-beta.4
  4. High · 7.3 CVE-2026-45364 < 1.4.17, >= 1.5.0-beta.1, < 1.5.0-beta.9 1.4.17, 1.5.0-beta.9
  5. Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes this entry
    Low CVE-2025-53535 < 1.2.10 1.2.10

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.