/

CVE-2025-71399

Severity:

HIGH RISK

(8.6)

Input Validation Flaw (CWE-20) in Better Auth Paths

CVE-2025-71399

Awaiting Analysis

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Access Control Bypass and Rate Limit Evasion

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Better Auth improperly validates URL paths when relying on a router that collapses multiple slashes into a single normalized path.

This can let attackers bypass disabled path protections and path-based rate limits by sending requests with extra slashes, unless an upstream proxy already normalizes URLs.

Affected context

The vulnerability appears in Better Auth setups that:

  • Depend on the better-call integration using the rou3 routing library
  • Enforce security controls using exact path strings for disabledPaths or rate limits
  • Do not have an upstream reverse proxy, load balancer, or platform that normalizes URL paths by collapsing multiple consecutive slashes

In these contexts, different-looking URLs such as /path, //path, and ///path can be routed identically while being treated differently by authorization and throttling logic.

Exploit preconditions

  • Attack surface: HTTP endpoints protected by Better Auth path-based configuration
  • Required access: Ability to send crafted HTTP requests to the affected service
  • Trigger point: Request routing where rou3 normalizes paths and Better Auth checks raw, unnormalized paths
  • Why exploitation is possible: The router treats multiple-slash variants of a path as equivalent, but the security configuration compares paths as literal strings, enabling discrepancies that bypass disabled paths and per-route rate limiting.

Why this happens

The core issue stems from inconsistent input validation and normalization of URL paths between the routing layer and the security configuration layer.

Rou3 collapses empty path segments, effectively normalizing /path, //path, and ///path to the same route, while Better Auth relies on exact path matching for disabledPaths and rate limits without applying the same normalization.

This mismatch aligns with CWE-20: Improper Input Validation, as the system fails to canonicalize and validate inputs consistently across components, allowing logically equivalent but syntactically different paths to evade controls.

Potential impact

  • Attackers may bypass disabled or blocked API routes using alternate multi-slash path representations.
  • Attackers could evade or delay path-based rate limits by alternating between slash variants of the same route.
  • Sensitive operations that rely on path restrictions can be exposed to unauthorized or excessive use.
  • Logging, monitoring, and audit trails may underreport or misclassify malicious activity due to path inconsistencies.

General mitigation guidance

Mitigation typically focuses on consistent canonicalization and validation of URL paths before applying any authorization or throttling decisions.

Recommended patterns include:

  • Canonically normalizing request paths (e.g., collapsing multiple slashes) at a single, trusted boundary and using the normalized value everywhere.
  • Centralizing path comparison logic so that routing, access control, and rate limiting share the same path representation.
  • Designing configuration formats to express rules in terms of normalized route identifiers rather than raw URL strings.
  • Applying defense-in-depth with upstream proxies or gateways that enforce strict, predictable URL normalization and reject malformed paths.

How teams detect issues like this

Detection efforts can focus on identifying inconsistencies between routing and security checks:

  • Static analysis or configuration review to flag places where raw request paths are compared directly to configuration strings without prior normalization.
  • Code review checklists that ask whether all path-based access control and rate limiting logic use the same canonicalization routine as the router.
  • Integration tests that exercise equivalent paths with multiple slashes and verify that disabledPaths and rate limits behave consistently.
  • Automated security scanning or fuzzing tools configured to generate URL variants with extra slashes and report discrepancies in responses or logging.

Sources

SourceLink
github.comgithub.com/better-auth/better-auth/commit/f60b43fa648399534507c9ac7db36d705b8874c3
github.comgithub.com/better-auth/better-auth/security/advisories/GHSA-x732-6j76-qmhm
vulncheck.comvulncheck.com/advisories/better-auth-before-path-normalization-bypass-via-rou3

Frequently asked

questions

It is exploitable wherever Better Auth relies on path-based disabledPaths or rate limits and the upstream stack does not normalize multiple slashes. Any client capable of sending HTTP requests can attempt to use multi-slash paths.

Only network access to the affected endpoints is required. The attacker does not need authentication to test for path variants unless the targeted route itself is authenticated.

Normalize all incoming URL paths using a consistent canonicalization routine before routing, authorization, or rate limiting, and ensure all security configurations reference these normalized paths rather than raw request strings.

Treat normalization as part of input validation, enforce a single canonical representation for URLs at system boundaries, include path canonicalization checks in code review and testing, and avoid duplicating path logic across routing and security components.

Find out what's already
exploitable in your codebase.