Skip to main content
MediumAPIOWASP A04:2021CWE-799

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

  1. 1Apply a rate-limit middleware to all API endpoints
  2. 2Key limits on the authenticated user ID for authed endpoints, or IP for anonymous ones
  3. 3Return 429 with Retry-After and RateLimit-* headers when the limit is hit

Code examples

express-rate-limit: basic setup

JavaScript
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

nginx
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.

See every api check

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.

Propose a checkHow a check is built

Scan your own site for api endpoint has no rate limiting

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: API endpoint has no rate limiting | VulnRadar