How to fix: API endpoint has no rate limiting
The API endpoint does not enforce rate limiting, allowing unlimited requests from a single client.
Why it matters
Without rate limiting, attackers can send unlimited requests to brute-force authentication, scrape all data, enumerate resources, or trigger denial of service, all without any server-side throttling.
Rate limiting protects APIs from abuse by capping the number of requests a client can make in a time window. Without it, automated attacks against authentication, search, or data endpoints are unconstrained.
How to fix it
- 1Apply a rate-limit middleware to all API endpoints
- 2Key limits on the authenticated user ID for authed endpoints, or IP for anonymous ones
- 3Return 429 with Retry-After and RateLimit-* headers when the limit is hit
Code examples
express-rate-limit: basic setup
import rateLimit from 'express-rate-limit';
const limiter = rateLimit({
windowMs: 60 * 1000,
max: 100,
standardHeaders: true,
legacyHeaders: false,
});
app.use('/api/', limiter);Nginx: rate limiting with burst
http {
limit_req_zone $binary_remote_addr zone=api:10m rate=60r/m;
server {
location /api/ {
limit_req zone=api burst=20 nodelay;
limit_req_status 429;
}
}
}References
Detected automatically by VulnRadar. The check id is rate-limiting, stable across every scan so you can filter or diff on it.
More api checks
- LowTRACE method referenced in API response body
- InfoREST endpoint allows DELETE
- LowGraphQL introspection field suggestions
- MediumGraphQL endpoint has no rate-limit headers
- LowOpenAPI server URL leaks internal host
- LowCORS preflight result not cached
- HighBearer token in URL query string
- MediumJSONP callback parameter accepted
Questions
- How severe is API endpoint has no rate limiting?
- VulnRadar rates this medium severity in the api category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id rate-limiting, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does API endpoint has no rate limiting map to?
- It maps to CWE-799. In the OWASP Top 10 it falls under A04:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.