Loading...
Skip to main content

CVE-2025-71401 — Vulnerability in better-auth — CVE Details

HIGH

Better Auth affected by external request basePath modification DoS

Published December 1, 2025Updated September 1, 2026Source: osv

Summary

# 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.

Advisory Timeline

  • First published December 1, 2025 (315 days ago).
  • Last revised September 1, 2026 — 274 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

npm
Update better-auth to 1.4.2 or later
npm install better-auth@1.4.2

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: npm (1).

PackageEcosystemAffectedFixed In
better-auth
npm
All versions1.4.2

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

Frequently Asked Questions

What is CVE-2025-71401?
Better Auth affected by external request basePath modification DoS This vulnerability has been assigned a severity rating of HIGH (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2025-71401?
CVE-2025-71401 affects better-auth. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-71401 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-569q-mpph-wgww

Related CVEs

  • CVE-2026-53512
    CRITICAL

    Better Auth: OAuth refresh-token replay via missing client authentication on oidc-provider and mcp plugins

  • CVE-2024-56734
    HIGH

    Better Auth has an Open Redirect Vulnerability in Verify Email Endpoint

  • CVE-2026-67336
    HIGH

    Better Auth has insecure cryptographic defaults in oidcProvider: alg=none advertised and plain PKCE accepted by default

  • CVE-2026-107375
    HIGH

    JHipster: SQL Injection in the Parameter of JHipster-Generated Reactive (WebFlux + R2DBC) Applicationssort

  • CVE-2026-107384
    HIGH

    MariaDB Connector/Node.js: SQL injection through object keys in SET expansion (permitSetMultiParamEntries)

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies