Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Feb 6, 2025

This PR contains the following updates:

Package Change Age Confidence
better-auth (source) 1.1.10 -> 1.3.26 age confidence

GitHub Vulnerability Alerts

GHSA-9x4v-xfq5-m8x5

Summary

The better-auth /api/auth/error page was vulnerable to HTML injection, resulting in a reflected cross-site scripting (XSS) vulnerability.

Details

The value of error URL parameter was reflected as HTML on the error page: https://github.com/better-auth/better-auth/blob/05ada0b79dbcac93cc04ceb79b23ca598d07830c/packages/better-auth/src/api/routes/error.ts#L81

PoC

https://demo.better-auth.com/api/auth/error?error=%3Cscript%3Ealert(1)%3C/script%3E

image

Impact

An attacker who exploited this vulnerability by coercing a user to visit a specially-crafted URL could execute arbitrary JavaScript in the context of the user's browser.

Because better-auth is a dependency of web applications, the impact of such a vulnerability is unknowable; it depends on the functionality of the application/site using better-auth. I have calculated the CVSS score assuming the hypothetical victim is an administrator with elevated permissions and access.

CVE-2025-27143

Summary

The application is vulnerable to an open redirect due to improper validation of the callbackURL parameter in the email verification endpoint and any other endpoint that accepts callback url. While the server blocks fully qualified URLs (e.g., https://evil.com), it incorrectly allows scheme-less URLs (e.g., //malicious-site.com). This results in the browser interpreting the URL as https://malicious-site.com, leading to unintended redirection.

bypass for : GHSA-8jhw-6pjj-8723

Affected Versions

All versions prior to 1.1.19

Details

The application’s email verification endpoint (/auth/verify-email) accepts a callbackURL parameter intended to redirect users after successful email verification. While the server correctly blocks fully qualified external URLs (e.g., https://evil.com), it improperly allows scheme-less URLs (e.g., //malicious-site.com). This issue occurs because browsers interpret //malicious-site.com as https://malicious-site.com, leading to an open redirect vulnerability.

An attacker can exploit this flaw by crafting a malicious verification link and tricking users into clicking it. Upon successful email verification, the user will be automatically redirected to the attacker's website, which can be used for phishing, malware distribution, or stealing sensitive authentication tokens.

Impact

Phishing & Credential Theft – Attackers can redirect users to a fake login page, tricking them into entering sensitive credentials, which can then be stolen.

Session Hijacking & Token Theft – If used in OAuth flows, an attacker could redirect authentication tokens to their own domain, leading to account takeover.

GHSA-vp58-j275-797x

Summary

A bypass was found for wildcard or absolute URLs trustedOrigins configurations and opens the victims website to a Open Redirect vulnerability, where it can be used to steal the reset password token of a victims account by changing the "callbackURL" parameter value to a website owned by the attacker.

Details

Absolute URLs

The issue here appears in the middleware, specifically. This protection is not sufficiente and it allows attackers to exploit a open redirect vulnerability, by using the payload /\/example.com. We can check this is a valid URL ( or it will be a valid URL because the URL parser fix it for us ), by checking the image bellow:

image

// trustedOrigins = [ "https://example.com" ]
validateURL("https://attacker.com", "callbackURL") // ❌ APIError, No Redirect
validateURL("/\/attacker.com", "callbackURL")       // ✅ Redirect to http://attacker.com

Regex

The issue here is because the regex is not strong enough [^/\\]*?\.example\.com[/\\]*? ( this is the regex it will be created if we have a wildcard as the trustedOrigins config ), but we can bypass by using a payload like:

// trustedOrigins = [ "*.example.com" ]
  ┌──────────────────┐       ┌────────────────┐       ┌─────────────────┐
  │ None of [ "/\" ] │ ────▶ │ ".example.com" │ ────▶ │ One of [ "/\" ] │
  └──────────────────┘       └────────────────┘       └─────────────────┘
          demo                  .example.com                    /               ✅ Redirect to https://example.com
          demo                  .attacker.com                   /               ❌ APIError, no redirect
   http:attacker.com?           .example.com                    /               ✅ Redirect to http://attacker.com

This works because : and ? are special chars in a URL, so when the URL parser sees, http: it will fix our happily fix our URL to http://attacker.com? and make .example.com as parameter, thus, bypassing this check.

PoC

We can PoC the open redirect by using the demo.better-auth.com.
If we access the URL bellow, we are redirected to example.com:

Impact

Every single website using the better-auth library, is vulnerable to un-auth open redirect and more importantilly, vulnerable to potential one click account take over vulnerability, as the attacker can send the victim a email to reset their account while changing the "redirectTo" parameter here, and when the victim clicks on the link, the reset token is sent to the attackers website, which then a attacker could use that token to reset the password of the victims account.

CVE-2025-53535

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

image
image 1

/verify-email

image
image

/delete-user/callback

image
image

/magic-link/verify

image
image

/oauth-proxy-callback

image
image

Impact

Untrusted open redirects in various routes.

CVE-2025-61928

Summary

Unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the api/auth/api-key/create route.

Details

The vulnerability exists in the authentication logic at when checking for user authentication then derives the user as session?.user ?? (authRequired ? null : { id: ctx.body.userId }). When no session exists but userId is present in the request body, authRequired becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when authRequired is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint.

PoC

curl -X POST http://localhost:3000/api/auth/api-key/create \
   -H 'Content-Type: application/json' \
   -d '{
         "userId": "victim-user-id",
         "name": "zeropath"
       }'

Response contains the new API key whose userId matches the victim, confirming the bypass.

Impact

This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges.

This issue was found by ZeroPath.


Release Notes

better-auth/better-auth (better-auth)

v1.3.26

Compare Source

   🐞 Bug Fixes
  • [security] api keys should properly check if a request is from client or server  -  by @​Bekacru (55608)
  • api-key: Shouldn't issue api key a mock session by default  -  by @​Bekacru (a49e5)
    View changes on GitHub

v1.3.25

Compare Source

   🚀 Features
   🐞 Bug Fixes
   🏎 Performance
    View changes on GitHub

v1.3.24

Compare Source

   🚀 Features
   🐞 Bug Fixes
   🏎 Performance
    View changes on GitHub

v1.3.23

Compare Source

v1.3.22

Compare Source

v1.3.21

Compare Source

v1.3.20

Compare Source

v1.3.19

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v1.3.18

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v1.3.17

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.16

Compare Source

No significant changes

    View changes on GitHub

v1.3.15

Compare Source

   🐞 Bug Fixes
    View changes on GitHub

v1.3.14

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.13

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.12

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.11

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.10

Compare Source

   Maintenance update: We fixed lots of issues from the community. Thanks to everyone for contributing to better-auth.

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.9

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.3.8

Compare Source

   🚀 Features
  • Support to infer error types fr

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the dependencies label Feb 6, 2025
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from f54b89e to 63d6f7a Compare February 24, 2025 18:44
@renovate renovate bot changed the title fix(deps): update dependency better-auth to v1.1.16 [security] fix(deps): update dependency better-auth to v1.1.20 [security] Feb 24, 2025
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 63d6f7a to 3acb0f9 Compare February 24, 2025 21:56
@renovate renovate bot changed the title fix(deps): update dependency better-auth to v1.1.20 [security] fix(deps): update dependency better-auth to v1.1.21 [security] Feb 24, 2025
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 3acb0f9 to 9aab25e Compare July 7, 2025 22:31
@renovate renovate bot changed the title fix(deps): update dependency better-auth to v1.1.21 [security] fix(deps): update dependency better-auth to v1.2.10 [security] Jul 7, 2025
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch 2 times, most recently from 9841941 to 2eb88e6 Compare August 13, 2025 17:44
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 2eb88e6 to 208464b Compare August 31, 2025 13:44
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 208464b to 5706a4a Compare September 25, 2025 14:12
@safedep
Copy link

safedep bot commented Sep 25, 2025

SafeDep Report Summary

Yellow Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

⚠ 1 packages are identified as suspicious, human review is recommended.

Package Details
Package Malware Vulnerability Risky License Report
icon better-auth @ 1.3.26
pnpm-lock.yaml
warning icon
ok icon
ok icon
🔗
icon @better-auth/core @ 1.3.26
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @better-auth/utils @ 0.3.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @better-fetch/fetch @ 1.1.18
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @noble/ciphers @ 2.0.1
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @noble/hashes @ 2.0.1
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-cms @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-csr @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-ecc @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-pfx @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-pkcs8 @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-pkcs9 @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-rsa @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-schema @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-x509 @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/asn1-x509-attr @ 2.6.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @peculiar/x509 @ 1.14.2
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @simplewebauthn/browser @ 13.2.2
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon @simplewebauthn/server @ 13.2.2
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon asn1js @ 3.0.6
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon better-call @ 1.0.19
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon jose @ 6.1.2
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon kysely @ 0.28.8
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon nanostores @ 1.0.1
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon set-cookie-parser @ 2.7.2
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon tsyringe @ 4.10.0
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗
icon zod @ 4.1.12
pnpm-lock.yaml
ok icon
ok icon
ok icon
🔗

This report is generated by SafeDep Github App

@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 5706a4a to d583d01 Compare October 9, 2025 17:30
@renovate renovate bot changed the title fix(deps): update dependency better-auth to v1.2.10 [security] fix(deps): update dependency better-auth to v1.3.26 [security] Oct 9, 2025
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from d583d01 to 04bdac5 Compare October 21, 2025 16:01
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 04bdac5 to 3155805 Compare November 10, 2025 19:00
@renovate renovate bot force-pushed the renovate/npm-better-auth-vulnerability branch from 3155805 to c376add Compare November 18, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant