Skip to content

Fix Lack of Rate Limiting on login - #55

Open
JBHook wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
JBHook:fix/no-rate-limit-login
Open

JBHook wants to merge 1 commit into
OWASP-CTF:dc34-ctffrom
JBHook:fix/no-rate-limit-login

Conversation

@JBHook

@JBHook JBHook commented Aug 9, 2026

Copy link
Copy Markdown

Summary

/users/v1/login had no rate limiting at all, making credential stuffing/password spraying/brute force trivial. Added a minimal in-memory sliding-window rate limiter (5 attempts / 60s per client IP, no new dependency).

Test plan

  • Booted the app locally and validated live: 5 rapid attempts succeed/fail normally; the 6th+ get 429 (even with correct credentials); after the 60s window elapses, login succeeds again.

/users/v1/login had no limit at all on how many attempts a client
could make, making credential stuffing, password spraying, and brute
force against any account trivial - nothing in the codebase throttled
repeated requests to this endpoint.

Added a simple in-memory sliding-window rate limiter keyed by client
IP: at most 5 login attempts per 60-second window, after which further
attempts get a 429 "Too many login attempts" response until the window
rolls forward. This is a minimal, dependency-free implementation
(no new package added) appropriate for a single-process app; a
production deployment behind a shared cache/reverse proxy would want a
centralized limiter instead, but this closes the endpoint's complete
lack of any throttling.

Verified live: 5 rapid login attempts (correct or incorrect
credentials) from the same client succeed/fail normally; the 6th and
7th attempts both get 429 instead of being processed, including a
request with the CORRECT password (rate limiting applies before
credentials are even checked); after the 60-second window elapses, a
legitimate login succeeds again normally.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🏆 VAmPI — CTF Patch Score

████░░░░░░░░░░░░░░░░  3 / 16 pts  (19%)

2 / 9 challenges patched

Per-challenge detail is withheld — it would reveal the rubric.

Commit: 0fd2016 · scoring run

🎉 Your result is on the leaderboard — see where you rank! 🏆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant