Skip to main content
HighAI codeOWASP A04:2021CWE-799

How to fix: Authentication Endpoint Lacks Rate Limiting

A login, password reset, or OTP verification endpoint was found without rate limiting headers or logic. AI-generated authentication scaffolding almost never includes rate limiting by default.

Why it matters

Without rate limiting on authentication endpoints, attackers can brute-force passwords, OTPs, and password reset codes at thousands of attempts per second with no throttling or lockout.

AI tools generate clean login handlers: validate email, check password, return token. Rate limiting, account lockout, and brute-force protection are rarely included because they require infrastructure decisions (Redis, database) that the AI avoids making.

How to fix it

  1. 1Add rate limiting to /login, /register, /reset-password, /verify-otp, and all authentication endpoints.
  2. 2Implement progressive delay: after 5 failures, slow down responses; after 10, lock the account temporarily.
  3. 3Use Redis-backed rate limiting (upstash/ratelimit, ioredis) that works across multiple server instances.
  4. 4Return 429 Too Many Requests with a Retry-After header when the limit is exceeded.

Code examples

Upstash rate limiting

TypeScript
import { Ratelimit } from '@upstash/ratelimit';
import { Redis } from '@upstash/redis';

const loginRateLimit = new Ratelimit({
  redis: Redis.fromEnv(),
  limiter: Ratelimit.slidingWindow(5, '1 m'), // 5 attempts per minute
});

export async function POST(req: Request) {
  const ip = req.headers.get('x-forwarded-for') ?? 'unknown';
  const { success, reset } = await loginRateLimit.limit(`login:${ip}`);
  if (!success) {
    return Response.json({ error: 'Too many attempts' }, {
      status: 429,
      headers: { 'Retry-After': String(Math.ceil((reset - Date.now()) / 1000)) },
    });
  }
  // ... proceed with authentication
}

References

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

See every ai code check

Questions

How severe is Authentication Endpoint Lacks Rate Limiting?
VulnRadar rates this high severity in the ai code 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 vibe-no-rate-limit, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Authentication Endpoint Lacks 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 authentication endpoint lacks 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

Authentication Endpoint Lacks Rate Limiting fix | VulnRadar