-
-
Notifications
You must be signed in to change notification settings - Fork 50
fix(deps): update dependency better-auth to v1.4.5 [security] #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
renovate
wants to merge
1
commit into
master
Choose a base branch
from
renovate/npm-better-auth-vulnerability
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f54b89e to
63d6f7a
Compare
63d6f7a to
3acb0f9
Compare
3acb0f9 to
9aab25e
Compare
9841941 to
2eb88e6
Compare
2eb88e6 to
208464b
Compare
208464b to
5706a4a
Compare
SafeDep Report SummaryPackage Details
This report is generated by SafeDep Github App |
5706a4a to
d583d01
Compare
d583d01 to
04bdac5
Compare
04bdac5 to
3155805
Compare
3155805 to
c376add
Compare
c376add to
848e629
Compare
848e629 to
0918ef7
Compare
0918ef7 to
b1d4599
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

This PR contains the following updates:
1.1.10->1.4.5GitHub Vulnerability Alerts
GHSA-9x4v-xfq5-m8x5
Summary
The better-auth
/api/auth/errorpage was vulnerable to HTML injection, resulting in a reflected cross-site scripting (XSS) vulnerability.Details
The value of
errorURL 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#L81Impact
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.
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 discovered in the trustedOrigins validation logic—affecting both absolute URL entries and wildcard domain patterns. This flaw allows an attacker to construct a malicious callbackURL that passes origin checks and triggers an open redirect.
Because redirect endpoints include sensitive tokens (such as password-reset tokens), this vulnerability can enable one-click account takeover if a victim clicks a crafted link.
CVE-2025-53535
Summary
An open redirect has been found in the
originCheckmiddleware function, which affects the following routes:/verify-email,/reset-password/:token,/delete-user/callback,/magic-link/verify,/oauth-proxy-callback.Details
In the
matchesPatternfunction,url.startsWith(can be deceived with aurlthat starts with one of thetrustedOrigins.Open Redirect PoCs
/reset-password/:token/verify-email/delete-user/callback/magic-link/verify/oauth-proxy-callbackImpact
Untrusted open redirects in various routes.
CVE-2025-61928
Summary
A critical authentication bypass was identified in the API key creation and update endpoints. An attacker could create or modify API keys for arbitrary users by supplying a victim’s user ID in the request body. Due to a flaw in how the authenticated user was derived, the endpoints could treat attacker-controlled input as an authenticated user object under certain conditions.
Details
The vulnerability originated from fallback logic used when determining the current user. When no session was present, the handler incorrectly allowed request-body data to populate the user context used for authorization decisions. Because server-side validation only executed when authentication was required, privileged fields were not properly protected. As a result, the API accepted unauthenticated requests that targeted other users.
This same pattern affected both the API key creation and update routes.
Impact
Unauthenticated attackers could generate or modify API keys belonging to any user. This granted full authenticated access as the targeted user and, depending on the user’s privileges, could lead to account compromise, access to sensitive data, or broader application takeover.
GHSA-569q-mpph-wgww
Summary
Affected versions of Better Auth allow an external request to configure
baseURLwhen it isn’t defined through any other means. This can be abused to poison the router’s base path, causing all routes to return 404 for all users.This issue is only exploitable when
baseURLis not explicitly configured (e.g.,BETTER_AUTH_URLis missing) and the attacker is able to make the very first request to the server after startup. In properly configured environments or typical managed hosting platforms, this fallback behavior cannot be reached.Details
A combination of
X-Forwarded-HostandX-Forwarded-Protois implicitly trusted. This allows the first request to configure baseURL whenever it is not explicitly configured.Here's the code that reads the headers:
Here's the call to
getBaseURL(), the result is assigned toctx.baseURL.Here's the router receiving the poisoned
basePath:X-Forwarded-HostandX-Forwarded-Protocan be used to modify the pathname of a parsed URL object which formsbaseURL.basePathis then derived from the pathname ofbaseURL. Once the routerbasePathis poisoned it fails to match & route incoming requests.Repro
Start a better-auth server with no
baseURLconfiguration.Send the following request as the first request to the server:
The better-auth API check endpoint returns 404.
Now send a regular request without the
X-Forwarded-ProtoandX-Forwarded-Hostheaders.The better-auth API check endpoint still returns 404.
Example result
We have modified the
basePathfor the router until the server is restarted. An attacker can repeatedly send these attack requests aiming to persistently exploit the vulnerability.GHSA-x732-6j76-qmhm
Summary
An issue in the underlying router library rou3 can cause
/pathand//pathto be treated as identical routes. If your environment does not normalize incoming URLs (e.g., by collapsing multiple slashes), this can allow bypasses ofdisabledPathsand path-based rate limits.Details
Better Auth uses better-call, which internally relies on rou3 for routing. Affected versions of rou3 normalize paths by removing empty segments. As a result:
/sign-in/email//sign-in/email///sign-in/email…all resolve to the same route.
Some production setups automatically collapse multiple slashes. This includes:
In these environments and other configurations where
//pathreach Better Auth as/path, the issue does not apply.Fix
Updating rou3 to the latest version resolves the issue:
"rou3": "^0.5.1"(commit: https://github.com/h3js/rou3/commit/f60b43fa648399534507c9ac7db36d705b8874c3)
Better Auth recommends:
Impact
disabledPathsThe impact of bypassing disabled paths could vary based on a project's configuration.
Release Notes
better-auth/better-auth (better-auth)
v1.4.5Compare Source
v1.4.4Compare Source
🚀 Features
🐞 Bug Fixes
View changes on GitHub
v1.4.3Compare Source
🚀 Features
🐞 Bug Fixes
View changes on GitHub
v1.4.2Compare Source
🚀 Features
/authforauth.ts- by @ping-maxwell in #6273 (53a74)🐞 Bug Fixes
View changes on GitHub
v1.4.1Compare Source
🚀 Features
🐞 Bug Fixes
generate-authenticate-optionsfrom POST to GET - by @mburumaxwell in #6199 (f922c)View changes on GitHub
v1.4.0Compare Source
🚀 Features
returnHeaderstogetSession- by @frectonz in #3983 (19d4b)storeStateStrategy- by @himself65 and Copilot in #5470 (b5f3b)search_pathconfiguration - by @okisdev in #5449 (bef33)getAdapter- by @himself65 in #5722 (10249)better-auth/minimal- by @bytaesu and @Bekacru in #5704 (1ebc6)cli- by @Kinfe123 and @himself65 in #4872 (70cb4)AuthClient- by @himself65 in #5815 (7caa2)disableSignalclient option - by @ping-maxwell in #6108 (f4c43)@standard-schema/spec- by @himself65 in #5629 (36315)generateOTP- by @ping-maxwell in #4723 (8ac4f)StripePlugintype - by @himself65 in #5509 (34431)🐞 Bug Fixes
Math.flooraround the division when calculating TTL - by @DevDuki, Dusan Misic, ping-maxwell and @himself65 in #4768 (14b9e)requestPasswordReset- by @Eazash in #5014 (2f94b)options.advanced.generateIdtype - by @himself65 (48249)node:async_hooksdirectly - by @himself65 in #5198 (0717e)whereof type TwoFactorWhereUniqueInput needs at least one ofidarguments - by @AlexStrNik in #5180 (2dab4)exactOptionalPropertyTypes- by @Kinfe123 and @himself65 in #5236 (f2723)ssoClientexport from client plugin - by @Kinfe123 in #5307 (ee229)HookEndpointContextandInternalContext- by @himself65 in #5359 (89475)shatobranchand made itcanaryby default - by @max-programming in #5491 (5bc26)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.
This PR was generated by Mend Renovate. View the repository job log.