/

CVE-2026-45364

Severity:

HIGH RISK

(7.3)

Improper Rate Limiting in Better Auth HTTP Rate Limiter

CVE-2026-45364

Deferred

Vulnerability type

Category:

Improper Rate Limiting

CWE:

CWE-307

Impact:

Authentication and Abuse-Rate Controls Bypass

Severity:

HIGH RISK

(7.3)

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's HTTP rate limiter keyed requests by the raw textual IP address taken from headers such as x-forwarded-for, without normalizing IPv6 representations.

Attackers with control over an IPv6 /64 range, or even just the textual form of a single IPv6 address, could rotate addresses or encodings to bypass per-IP rate limits on sensitive endpoints like sign-in, sign-up, and password reset.

Affected context

This vulnerability affects applications using Better Auth's built-in HTTP rate limiter in deployments where:

  • IP-based rate limiting is enabled and relied upon to throttle abusive traffic.
  • Client IPs are obtained from x-forwarded-for or a similar proxy/header-based source.
  • A significant portion of users connect over IPv6, especially where clients may control large address blocks (e.g., /64).

In such environments, rate limiting decisions are made per textual IP string rather than per logical client or network segment, allowing adversaries to evade abuse controls.

Exploit preconditions

  • Attack surface: Any HTTP endpoint protected by Better Auth's rate limiter, including /sign-in/email, /sign-up/email, and /forget-password.
  • Required access: Network-level access to send HTTP requests to the target service (e.g., over the public internet or internal network).
  • IP control: Ability to:
  • Rotate source IPv6 addresses within a controllable block (common for some ISPs, cloud, or botnets), or
  • Manipulate the textual representation of a stable IPv6 address (case changes, compression forms, IPv4-mapped forms, etc.).
  • Trigger point: Sending repeated requests with varying IPv6 addresses or encodings so each is treated as a distinct key by the rate limiter.
  • Why exploitation is possible: The limiter uses the literal header string as the key, without canonicalizing or normalizing IPv6 addresses, so logically identical or closely related addresses are tracked as independent clients.

Why this happens

The underlying issue is an improper implementation of rate limiting logic that treats the textual IP string as the unique identifier for client identity and quota enforcement.

Instead of:

  • Normalizing IP addresses (especially IPv6) into a canonical binary or textual representation, or
  • Grouping addresses by appropriate network prefixes (e.g., /64 for IPv6) or alternative client identifiers,

the rate limiter directly uses the unprocessed header value. For IPv6, multiple syntactically different strings can represent the same address, and typical allocations grant large address spaces to a single endpoint.

This maps to CWE-307: Improper Restriction of Excessive Authentication Attempts, because the intended throttling of repeated authentication or sensitive actions can be bypassed by trivial variations in the IP key, effectively removing the practical limit on attempts.

Potential impact

  • Attackers may bypass rate limits on authentication endpoints, enabling high-volume credential stuffing or password spraying.
  • Automated sign-up abuse could proceed at scale, leading to fake account creation and downstream fraud.
  • Password reset flows could be probed repeatedly, aiding account takeover attempts or user enumeration.
  • Application-layer denial-of-service (DoS) attacks may become more feasible as abusive traffic is not effectively throttled.
  • Security controls and monitoring that assume per-IP enforcement may provide a false sense of protection.

General mitigation guidance

Effective mitigation centers on robust client identification and proper IP normalization in rate limiting strategies:

  • Normalize IP addresses: Convert all client IPs to a canonical form before keying, using well-tested IP parsing utilities that handle IPv4, IPv6, and IPv4-mapped IPv6 addresses consistently.
  • Use network-prefix limits: For IPv6, consider grouping by a configured prefix (e.g., /64 or /56) instead of individual addresses, acknowledging that many addresses may belong to a single logical client.
  • Diversify identifiers: Combine IP-based limits with other signals such as account ID, user agent, device identifiers, or session cookies, where privacy and policy allow.
  • Separate control planes: Apply stricter and more conservative limits on sensitive endpoints (login, registration, password reset) than on general API traffic.
  • Least-privilege assumptions: Do not rely solely on IP-based throttling for abuse prevention; treat it as one layer in a broader defense-in-depth strategy that includes robust authentication, anomaly detection, and business-logic checks.

How teams detect issues like this

Detection typically involves both code-level review and runtime monitoring:

  • Static analysis & code review:
  • Look for rate limiting code that keys directly on raw header values such as x-forwarded-for without parsing or normalization.
  • Flag implementations where IPv6 handling is absent, naive, or treated identically to IPv4 without considering address space and formatting differences.
  • Review middleware and reverse proxy configurations to ensure a single, trusted source of client IP is used.
  • Configuration and policy checks:
  • Enforce policies that require canonicalization of IP addresses at ingress or within a gateway layer before rate limiting is applied.
  • Validate that limits are defined per logical client or network segment, not just per raw string token.
  • Runtime signals:
  • Monitor for unusually high aggregate request rates from broad IPv6 ranges with low apparent per-IP rates.
  • Analyze logs to detect many distinct IP strings associated with similar request patterns or identifiers (e.g., same user-agent, same accounts targeted).
  • Automated tooling:
  • Incorporate security linting or SAST tools that recognize common rate limiting pitfalls.
  • Use integration tests or security tests that attempt to exceed rate limits using varied IPv6 encodings or addresses.

Sources

SourceLink
github.comgithub.com/better-auth/better-auth/commit/43e719bcc0c223c7079fa0c611a9cf7ea1188254
github.comgithub.com/better-auth/better-auth/commit/57af0f7b910dcf7b1a5c0615d10b9bd56bb69bef
github.comgithub.com/better-auth/better-auth/pull/7470
github.comgithub.com/better-auth/better-auth/pull/7509
github.comgithub.com/better-auth/better-auth/security/advisories/GHSA-p6v2-xcpg-h6xw

Frequently asked

questions

Yes. Any remote client able to send HTTP requests to the service and control either their IPv6 address range or the textual form of the IP header can exploit this issue to bypass rate limits.

No. The issue affects the pre-authentication paths protected by the rate limiter, such as login, registration, and password reset endpoints. An unauthenticated attacker can exploit it purely via crafted network traffic and IP variations.

Normalize all client IP addresses into a canonical form using a robust parsing library, then apply rate limits based on appropriate groupings (e.g., IPv6 prefixes plus additional identifiers like account or device where appropriate). Avoid using raw header strings as keys and ensure that sensitive endpoints have conservative, layered limits.

When designing rate limiting and abuse defenses, explicitly model how IPv4 and IPv6 addresses behave, require canonicalization of IPs at boundaries, and combine IP-based limits with other client attributes. Integrate security review for authentication workflows, add tests that attempt to evade limits through address and encoding variations, and enforce internal standards for how client identity is derived and keyed.

Find out what's already
exploitable in your codebase.