Skip to content

chore(deps): update dependency better-auth to v1.4.5 [security]#6238

Open
renovate[bot] wants to merge 2 commits intomainfrom
renovate/npm-better-auth-vulnerability
Open

chore(deps): update dependency better-auth to v1.4.5 [security]#6238
renovate[bot] wants to merge 2 commits intomainfrom
renovate/npm-better-auth-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Dec 28, 2025

ℹ️ Note

This PR body was truncated due to platform limits.

This PR contains the following updates:

Package Change Age Confidence
better-auth (source) 1.3.271.4.5 age confidence

Better Auth affected by external request basePath modification DoS

GHSA-569q-mpph-wgww

More information

Details

Summary

Affected versions of Better Auth allow an external request to configure baseURL when 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 baseURL is not explicitly configured (e.g., BETTER_AUTH_URL is 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-Host and X-Forwarded-Proto is implicitly trusted. This allows the first request to configure baseURL whenever it is not explicitly configured.

Here's the code that reads the headers:

headers

Here's the call to getBaseURL(), the result is assigned to ctx.baseURL.

write

Here's the router receiving the poisoned basePath:

router

X-Forwarded-Host and X-Forwarded-Proto can be used to modify the pathname of a parsed URL object which forms baseURL. basePath is then derived from the pathname of baseURL. Once the router basePath is poisoned it fails to match & route incoming requests.

Repro

Start a better-auth server with no baseURL configuration.

Send the following request as the first request to the server:

curl -i --location 'https://example.com/api/auth/ok' \
--header 'X-Forwarded-Proto: some:' \
--header 'X-Forwarded-Host: junk'

The better-auth API check endpoint returns 404.

Now send a regular request without the X-Forwarded-Proto and X-Forwarded-Host headers.

curl -i --location 'https://example.com/api/auth/ok'

The better-auth API check endpoint still returns 404.

Example result

attack

We have modified the basePath for the router until the server is restarted. An attacker can repeatedly send these attack requests aiming to persistently exploit the vulnerability.

Severity

  • CVSS Score: 2.9 / 10 (Low)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Better Auth's rou3 Dependency has Double-Slash Path Normalization which can Bypass disabledPaths Config and Rate Limits

GHSA-x732-6j76-qmhm

More information

Details

Summary

An issue in the underlying router library rou3 can cause /path and //path to be treated as identical routes. If your environment does not normalize incoming URLs (e.g., by collapsing multiple slashes), this can allow bypasses of disabledPaths and 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 //path reach Better Auth as /path, the issue does not apply.

Fix

Updating rou3 to the latest version resolves the issue:

Better Auth recommends:

  1. Upgrading to Better Auth v1.4.5 or later, which includes the updated rou3.
  2. Ensuring the proxy normalizes URLs.
  3. If project maintainers cannot upgrade yet, they can protect their app by normalizing url before it reaches better-auth handler. See example below:
const req = new Request(...) // this would be the actual request object
const url = new URL(req.url);
const normalizedPath = url.pathname.replace(/\/+/g, "/");

if (url.pathname !== normalizedPath) {
  url.pathname = normalizedPath;
  // Update the raw request pathname
  Object.defineProperty(req, "url", {
    value: url.toString(),
    writable: true,
    configurable: true,
  });
}
Impact
  • Bypass disabledPaths
  • Bypass path-based rate limits

The impact of bypassing disabled paths could vary based on a project's configuration.

Severity

  • CVSS Score: 8.6 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

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

v1.4.5

Compare Source

v1.4.4

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.3

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.2

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.1

Compare Source

   🚀 Features
   🐞 Bug Fixes
    View changes on GitHub

v1.4.0

Compare Source

   🚀 Features
   🐞 Bug Fixes

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, 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 Pull requests that update a dependency file label Dec 28, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 28, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 083d9522-e990-4bf7-81bd-ee6e60f2851f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch renovate/npm-better-auth-vulnerability

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Dec 28, 2025

View your CI Pipeline Execution ↗ for commit 51af64e

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 2m 56s View ↗
nx run-many --target=build --exclude=examples/*... ❌ Failed 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-25 18:15:47 UTC

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from e3d03c7 to 3c4e172 Compare December 30, 2025 01:12
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 3 times, most recently from 03055bf to 3e6b05f Compare January 11, 2026 23:42
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 7 times, most recently from ee19ecc to e91a0ac Compare February 1, 2026 14:02
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 8 times, most recently from baf6cbc to 102ffe9 Compare February 9, 2026 01:21
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from 102ffe9 to 73be987 Compare February 15, 2026 11:45
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 2 times, most recently from a322ca8 to 94d1aad Compare February 22, 2026 21:40
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from 94d1aad to 72323c2 Compare April 16, 2026 05:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 3 times, most recently from 44aab81 to 63a2ed4 Compare April 16, 2026 22:08
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from 36c43ad to ac09331 Compare April 24, 2026 01:59
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 3 times, most recently from f4f0b9c to 63e49a9 Compare April 24, 2026 20:41
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 2 times, most recently from 2bb7786 to 4c15ad0 Compare April 24, 2026 22:17
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 2 times, most recently from 0142404 to e37bf82 Compare April 24, 2026 23:39
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 3 times, most recently from 1ece2ab to 1978c9c Compare April 25, 2026 00:09
nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch 2 times, most recently from 197f0f0 to 32e2456 Compare April 25, 2026 02:21
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from 32e2456 to a4e5a15 Compare April 25, 2026 16:38
nx-cloud[bot]

This comment was marked as outdated.

@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from a4e5a15 to 14adeb6 Compare April 25, 2026 17:41
@renovate renovate Bot force-pushed the renovate/npm-better-auth-vulnerability branch from 14adeb6 to a78f4a8 Compare April 25, 2026 17:58
nx-cloud[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud has identified a possible root cause for your failed CI:

This CI failure appears to be related to the environment or external dependencies rather than your code changes.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@renovate
Copy link
Copy Markdown
Contributor Author

renovate Bot commented Apr 25, 2026

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants