Login endpoint has rate limiting
Why it matters
An unprotected login endpoint allows unlimited automated password guessing. CWE-307 (Improper Restriction of Excessive Authentication Attempts) is one of the most exploited authentication failures: a botnet can attempt millions of credential combinations against any account in minutes. NIST 800-63B §5.2.2 and PCI-DSS Req-8.3.4 both mandate throttling on authentication endpoints. OWASP A07 lists brute-force susceptibility as a named failure mode. In-memory rate limiting does not survive serverless cold starts or multi-instance deployments — Redis-backed state is required for distributed environments.
Severity rationale
Critical because an unthrottled login endpoint allows automated brute-force attacks that can compromise any account given sufficient time and a common password list.
Remediation
Use a Redis-backed rate limiter that persists state across serverless instances. Limit by IP and by username to catch both distributed and targeted attacks:
// Using @upstash/ratelimit (serverless-safe)
import { Ratelimit } from '@upstash/ratelimit'
import { Redis } from '@upstash/redis'
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(10, '15 m'),
prefix: 'login'
})
export async function POST(request: Request) {
const ip = request.headers.get('x-forwarded-for') ?? 'unknown'
const { success } = await ratelimit.limit(ip)
if (!success) return Response.json({ error: 'Too many attempts' }, { status: 429 })
// login logic
}
Apply the same rate limit to password reset and OTP verification endpoints — they are equally vulnerable to abuse and are frequently overlooked.
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 Authentication 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
- owasp:2021 · A07
- nist:rev4 · SP-800-63B §5.2.2 — Rate Limiting (Throttling)
- pci-dss:4.0 · Req 8.3.4
- soc2:2017 · CC6.6 — Protection against threats from outside system boundaries
Taxons
History
- 2026-04-18·v1.0.0·Initial import from saas-authentication·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