CVE-2025-71401: Better auth Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-569q-mpph-wgww
CWE-770 CWE-73
Published
Advisory Summary

CVE-2025-71401 is a HIGH denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Better auth libraries in the npm ecosystem. The issue involves better auth affected by external request basepath modification dos. Remediation is available by upgrading affected packages to version 1.4.2.

CVE-2025-71401 at a Glance

CVE Identifier CVE-2025-71401
GHSA Identifier GHSA-569q-mpph-wgww
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Better auth
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-71401

To remediate this vulnerability, upgrade all affected Better auth dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

better-auth fixed: 1.4.2
npm install better-auth@1.4.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls better-auth

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-71401, inspect your project dependencies using npm:

npm ls better-auth

Analyze the terminal output to locate any version of Better auth in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.2), your application is affected.

Note: The npm ls better-auth command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Better auth, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# 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: <img width="631" height="219" alt="headers" src="https://github.com/user-attachments/assets/b3fb0078-a62f-4058-9d0b-4afbd30c4953" /> Here's the call to `getBaseURL()`, the result is assigned to `ctx.baseURL`. <img width="838" height="414" alt="write" src="https://github.com/user-attachments/assets/a7b4dd17-75c3-49ef-9d08-6a2079d6a0ea" /> Here's the router receiving the poisoned `basePath`: <img width="594" height="372" alt="router" src="https://github.com/user-attachments/assets/5fdf2862-9cd1-4b96-b146-18e67d904157" /> `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 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 curl -i --location 'https://example.com/api/auth/ok' ``` The better-auth API check endpoint still returns 404. _Example result_ <img width="662" height="307" alt="attack" src="https://github.com/user-attachments/assets/5a9cfdb5-3db7-4504-9f0a-b3c32a6dc823" /> 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.

CVE-2025-71401 Affected Better auth Versions

1 component(s)
Fixed Versions:
1.4.2
Product / Package Ecosystem Affected Versions Fixed Version
better-auth
npm
< 1.4.2
1.4.2

References

Frequently Asked Questions

What is CVE-2025-71401?
CVE-2025-71401 is a security vulnerability in Better auth involving Better Auth affected by external request basePath modification DoS under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Better auth versions are affected?
Affected versions include releases prior to 1.4.2 across affected packages: better-auth.
What version fixes CVE-2025-71401?
Upgrading to 1.4.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is better-auth affected?
Yes, better-auth is affected in releases prior to 1.4.2. Upgrade your dependency to 1.4.2 or later.
What CWE is associated with CVE-2025-71401?
CVE-2025-71401 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check npm dependencies for CVE-2025-71401?
Run the dependency tree command: 'npm ls better-auth'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-569q-mpph-wgww",
  "modified" : "2026-09-01T18:56:11Z",
  "published" : "2025-12-01T21:29:48Z",
  "aliases" : [ "CVE-2025-71401" ],
  "summary" : "Better Auth affected by external request basePath modification DoS",
  "details" : "# Summary\n\nAffected 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.\n\nThis 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.\n\n# Details\n\nA 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.\n\nHere's the code that reads the headers:\n\n<img width=\"631\" height=\"219\" alt=\"headers\" src=\"https://github.com/user-attachments/assets/b3fb0078-a62f-4058-9d0b-4afbd30c4953\" />\n\nHere's the call to `getBaseURL()`, the result is assigned to `ctx.baseURL`.\n\n<img width=\"838\" height=\"414\" alt=\"write\" src=\"https://github.com/user-attachments/assets/a7b4dd17-75c3-49ef-9d08-6a2079d6a0ea\" />\n\nHere's the router receiving the poisoned `basePath`:\n\n<img width=\"594\" height=\"372\" alt=\"router\" src=\"https://github.com/user-attachments/assets/5fdf2862-9cd1-4b96-b146-18e67d904157\" />\n\n`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.\n\n# Repro\n\nStart a better-auth server with no `baseURL` configuration.\n\nSend the following request as the first request to the server:\n\n```curl\ncurl -i --location 'https://example.com/api/auth/ok' \\\n--header 'X-Forwarded-Proto: some:' \\\n--header 'X-Forwarded-Host: junk'\n```\n\nThe better-auth API check endpoint returns 404.\n\nNow send a regular request without the `X-Forwarded-Proto` and `X-Forwarded-Host` headers.\n\n```curl\ncurl -i --location 'https://example.com/api/auth/ok'\n```\n\nThe better-auth API check endpoint still returns 404.\n\n_Example result_\n\n<img width=\"662\" height=\"307\" alt=\"attack\" src=\"https://github.com/user-attachments/assets/5a9cfdb5-3db7-4504-9f0a-b3c32a6dc823\" />\n\nWe 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" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "better-auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/better-auth/better-auth/security/advisories/GHSA-569q-mpph-wgww"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-71401"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ray-project/ray/commit/70e7c72780bdec075dba6cad1afe0832772bfe09"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/better-auth/better-auth"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/better-auth/better-auth/releases/tag/v1.4.2"
  }, {
    "type" : "WEB",
    "url" : "https://www.vulncheck.com/advisories/better-auth-before-basepath-modification-dos"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-73", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-01T21:29:48Z",
    "nvd_published_at" : null
  }
}