Skip to main content
MediumAPIOWASP A04:2021CWE-799

How to fix: Rate-limit keyed only on client IP, no auth required

Per-IP throttling is fine for anonymous traffic, but auth-less endpoints behind a shared NAT or proxy can be exhausted by one noisy neighbour.

Why it matters

IP-based rate limiting can be exhausted by a single user behind a corporate NAT or Tor exit node, blocking all users sharing that IP. Conversely, an attacker rotating IPs or using botnets can bypass it entirely for brute-force or scraping attacks.

Per-IP throttling is fine for anonymous traffic, but auth-less endpoints behind a shared NAT or proxy can be exhausted by one noisy neighbour.

How to fix it

  1. 1Require authentication on sensitive endpoints and key rate limits on the authenticated principal (user ID)
  2. 2Layer rate limits: per-IP for anonymous endpoints, per-user for authenticated endpoints
  3. 3Use Redis for distributed rate limiting across multiple server instances

Code examples

express-rate-limit: per-user after auth

JavaScript
import rateLimit from 'express-rate-limit';

const authRateLimit = rateLimit({
  windowMs: 60 * 1000,
  max: 100,
  keyGenerator: (req) => req.user?.id ?? req.ip,
  standardHeaders: true,
  legacyHeaders: false,
});

// Apply after auth middleware so req.user is available
router.use(requireAuth, authRateLimit);

References

Detected automatically by VulnRadar. The check id is api-rate-limit-per-ip-no-auth, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is Rate-limit keyed only on client IP, no auth required?
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 api-rate-limit-per-ip-no-auth, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Rate-limit keyed only on client IP, no auth required 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 rate-limit keyed only on client ip, no auth required

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

Rate-limit keyed only on client IP, no auth required | VulnRadar