Skip to content
PatchBriefing

Search PatchBriefing

Type at least two characters. Results update as you type.

Search CVEs, products, packages and article titles.

Nothing found. Identifiers such as CVE and GHSA can be searched in both languages.

Subscribe

Low · 3.7 Node.js & npm GHSA-44jh-23m7-hpcf

better-auth: Concurrent Requests Can Bypass PostgreSQL-Backed Rate Limits

A race condition in the Drizzle and Kysely database adapters for better-auth allows a burst of concurrent requests to exceed configured rate limits when records are stored in PostgreSQL, weakening protections on login, 2FA, OTP, and password reset endpoints.

By PatchBriefing ·

Produced automatically from official sources with the help of AI. How we work →

Synthesized by AI from 1 source · updated 1 week ago

AI summary

A vulnerability has been published affecting the database adapters used by better-auth, a JavaScript authentication library, when rate-limit counters are stored in a PostgreSQL database. The issue allows an attacker who sends many requests at the same time to exceed the number of attempts normally permitted by the configured rate limit. This weakens protection on sensitive endpoints such as password sign-in, two-factor verification, one-time codes, and password resets.

What happened

A vulnerability identified as GHSA-44jh-23m7-hpcf has been disclosed for the `@better-auth/drizzle-adapter` and `@better-auth/kysely-adapter` packages used with the `better-auth` library. When rate-limit records are kept in a PostgreSQL database, a burst of concurrent requests can pass the rate-limit check together before any of them is counted, allowing more attempts than the configured maximum.

Technical cause

The vulnerability is classified under CWE-307 (Improper Restriction of Excessive Authentication Attempts). The rate-limit check-and-increment operation in the affected PostgreSQL-backed adapters is not atomic, meaning multiple simultaneous requests can each read the counter before it is updated, letting several requests through that should have been blocked. The issue does not bypass password or one-time-code validation itself, and does not directly compromise an account; it only allows additional attempts.

Why it matters

Rate limiting on authentication endpoints is a defense against brute-force and credential-stuffing attacks. If an attacker can exceed the intended limit by sending requests concurrently, protections on password sign-in, two-factor verification, one-time codes, and password reset flows are weakened. The extent of the extra attempts possible is bounded by the number of concurrent database connections, the number of application instances, and the configured rate-limit window.

Who is affected

You are affected if all of the following are true: you use `@better-auth/drizzle-adapter` versions from 1.6.17 up to (but not including) 1.7.7, or `@better-auth/kysely-adapter` versions from 1.6.17 through 1.6.31; rate limiting is enabled; and rate-limit records are stored in a PostgreSQL database. Deployments that store rate-limit records in memory (the default) or in secondary storage are not affected.

Affected versions

`@better-auth/drizzle-adapter`: versions >= 1.6.17 and < 1.7.7. `@better-auth/kysely-adapter`: versions >= 1.6.17 and < 1.7.0. `better-auth`: versions >= 1.6.17 and < 1.7.7.

Fixes and mitigation

`@better-auth/kysely-adapter` is fixed in version 1.7.0; users should upgrade to that version or later. The fix for `@better-auth/drizzle-adapter` has been merged and is planned for release as version 1.7.7, but that package version is not yet available. When it is released, `better-auth` and the installed Drizzle adapter should be upgraded together. No database schema or public API migration is required for the fix. Until a fix is available for the Drizzle adapter, mitigations include storing rate-limit records in secondary storage instead of PostgreSQL, using a custom rate-limit storage implementation that checks and increments the counter in a single atomic step, or enforcing the intended limit at an upstream layer such as a reverse proxy or gateway. In-memory storage also avoids the issue, but does not enforce a single shared limit across multiple application instances or serverless deployments.

Recommended action

Check whether your deployment stores rate-limit records in PostgreSQL via `@better-auth/drizzle-adapter` or `@better-auth/kysely-adapter`. If using the Kysely adapter, upgrade to version 1.7.0 or later. If using the Drizzle adapter, monitor for the release of version 1.7.7 and apply it together with a matching `better-auth` update once available. In the meantime, consider the documented workarounds, particularly moving rate-limit storage away from PostgreSQL or adding upstream rate limiting.

PatchBriefing score

3.7 / 10 · Low

Official CVSS: 3.7

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

Why this score

The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.

Affected versions

@better-auth/drizzle-adapter >= 1.6.17, < 1.7.7
vulnerable
≥ 1.7.7
patched
@better-auth/kysely-adapter >= 1.6.17, < 1.7.0
vulnerable
≥ 1.7.0
patched
better-auth >= 1.6.17, < 1.7.7
vulnerable
≥ 1.7.7
patched

Reported fixes

`@better-auth/kysely-adapter` is fixed in version 1.7.0; users should upgrade to that version or later. The fix for `@better-auth/drizzle-adapter` has been merged and is planned for release as version 1.7.7, but that package version is not yet available. When it is released, `better-auth` and the installed Drizzle adapter should be upgraded together. No database schema or public API migration is required for the fix. Until a fix is available for the Drizzle adapter, mitigations include storing rate-limit records in secondary storage instead of PostgreSQL, using a custom rate-limit storage implementation that checks and increments the counter in a single atomic step, or enforcing the intended limit at an upstream layer such as a reverse proxy or gateway. In-memory storage also avoids the issue, but does not enforce a single shared limit across multiple application instances or serverless deployments.

How this was built

1 source records were collected, matched and used to prepare the report above.

  • GitHub Advisory Database database
Unified report
better-auth: Concurrent Requests Can Bypass PostgreSQL-Backed Rate Limits
1 article · 1 sources cited
Revision history
  1. Published
  2. Generated
The Morning Brief

Relevant changes for the stacks you follow.

Choose your stacks, topics and optional WordPress plugins. At 07:00 CET, matching advisories and releases from the reporting period are grouped into one email.

✓ Choose stacks and topics✓ Change preferences anytime✓ One grouped email