IP-based rate limiting on unauthenticated endpoints
Why it matters
Login, password reset, and account creation endpoints without IP-based rate limiting are open to brute-force credential stuffing and enumeration attacks. CWE-307 (Improper Restriction of Excessive Authentication Attempts) is the direct classification. OWASP API Security Top 10 2023 API4 (Unrestricted Resource Consumption) applies because password reset emails and SMS OTPs are finite, paid resources attackers can exhaust. Credential stuffing tools spray millions of username/password combinations against unthrottled login endpoints. Without rate limiting, an attacker with a breached credential list can test thousands of combinations per minute from a single IP.
Severity rationale
Low because brute force on unauthenticated endpoints is mitigated by strong passwords and MFA — but absent those controls, unthrottled login endpoints become the attack path.
Remediation
Apply tight IP-based rate limits specifically on auth-critical unauthenticated endpoints. Use a shorter window and lower threshold than general API rate limits.
// src/app/api/auth/login/route.ts
import { ipRateLimit } from '@/lib/rate-limit'
export async function POST(req: Request) {
const ip = req.headers.get('x-forwarded-for')?.split(',')[0] ?? 'unknown'
const allowed = await ipRateLimit(ip, { max: 5, windowSeconds: 900 }) // 5 per 15 min
if (!allowed) {
return Response.json(
{ error: 'Too many attempts. Try again in 15 minutes.' },
{ status: 429, headers: { 'Retry-After': '900' } }
)
}
// ... authentication logic
}
Apply the same limiter to /api/auth/forgot-password and /api/auth/register to prevent email/SMS bombing.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the API Security Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-307 — Improper Restriction of Excessive Authentication Attempts
- cwe · CWE-770 — Allocation of Resources Without Limits or Throttling
- owasp:2021 · A07 — Identification and Authentication Failures
- owasp:2023 · API4 — Unrestricted Resource Consumption
- soc2:2017 · CC6.6 — Protection against threats from outside system boundaries
Taxons
History
- 2026-04-18·v1.0.0·Initial import from api-security·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.6) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2