CVE-2026-133312 in rate-limit
Summary
by MITRE • 11/21/2026
@fastify/rate-limit is the rate-limiting plugin for the Fastify web framework. Starting in version 11.1.0, the plugin documented a manual flow for limiting failed login attempts that peeks at the limiter, runs the password check, and consumes a slot only on failure. Because the peek and the consume are two separate store operations with the password check in between, concurrent requests can all pass the peek before any slot is consumed, so in versions 11.1.0 through 11.2.2 a burst of requests runs far more failed attempts than the configured limit, and the sequential path also allowed one attempt more than configured. The default per-request limiter is not affected. The issue is fixed in @fastify/rate-limit 11.3.0, which makes the manual flow atomic by reserving a slot in a single operation and refunding it only on success, and users should upgrade to 11.3.0 or later.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 11/21/2026
The vulnerability identified within @fastify/rate-limit versions 11.1.0 through 11.2.2 represents a critical race condition in the implementation of manual rate limiting logic designed to secure authentication endpoints against brute-force attacks. The plugin serves as a protective mechanism for Fastify web applications, aiming to restrict the number of requests allowed within a specific time window. In this context, developers often implement custom flows where they inspect current usage before executing sensitive operations such as password verification. The documented approach in these vulnerable versions involved peeking at the rate limiter's state to check if limits were reached, proceeding with the password check, and only consuming a counter slot upon failure. This design intended to avoid penalizing successful login attempts while still restricting failed ones. However, this sequential execution model introduces a significant timing window that undermines the integrity of the rate limiting mechanism under concurrent load conditions.
From a technical perspective, the core flaw lies in the non-atomic nature of the peek and consume operations when separated by an external process like password hashing or database verification. When multiple requests arrive simultaneously, each request can execute the initial check against the limiter's current state before any single request has incremented the counter to reflect its own attempt. Consequently, all concurrent requests perceive that they are within the allowed limit because none of them have yet consumed a slot. This allows an attacker to bypass the intended restrictions by sending a burst of authentication attempts in rapid succession. The system fails to enforce the configured threshold accurately during these high-concurrency scenarios, effectively rendering the rate limiting ineffective for protecting against automated credential stuffing or brute-force attacks that leverage parallel connections.
The operational impact of this vulnerability is severe for applications relying on @fastify/rate-limit for security hardening. Attackers can exploit this race condition to perform significantly more failed login attempts than the configured limit would normally permit, potentially leading to account compromise through password guessing if weak credentials are in use. Furthermore, even in sequential execution paths where concurrency is not a factor, the logic allowed one additional attempt beyond the specified limit due to implementation inconsistencies in how the counter was managed relative to the check. This deviation from expected behavior means that security policies defined by administrators were not strictly enforced, creating gaps in defense-in-depth strategies. The default per-request limiter remains unaffected as it utilizes atomic operations internally, but any application adopting the manual flow pattern described in the documentation remained exposed to this bypass technique.
This vulnerability aligns with CWE-362, which describes concurrent execution using shared resources with improper synchronization, specifically manifesting here as a race condition that allows unauthorized access or resource exhaustion beyond defined limits. In terms of offensive security frameworks, it relates to MITRE ATT&CK techniques involving brute force attacks where the defender's controls are bypassed through timing exploits rather than direct exploitation of code logic errors like buffer overflows. The lack of atomicity in state modification permits an attacker to exploit the gap between decision and action, a classic flaw in distributed systems that handle high volumes of concurrent requests without proper locking or transactional guarantees for counter increments.
To mitigate this vulnerability, organizations must upgrade @fastify/rate-limit to version 11.3.0 or later immediately. The fix addresses the issue by making the manual flow atomic through a reservation mechanism where a slot is reserved in a single operation and only refunded if the authentication attempt succeeds. This ensures that even under high concurrency, each request consumes a limit counter entry regardless of success or failure at the time of arrival, thereby enforcing the intended rate limits accurately. Developers should also review any custom implementations to ensure they do not rely on non-atomic peek-and-consume patterns and instead utilize atomic operations provided by modern libraries or implement proper locking mechanisms if building custom solutions. Regular security audits and dependency updates are essential to maintain robust protection against automated attacks targeting authentication endpoints.