Skip to content

Login brute-force lockout only tracks per-account; IP rotation bypasses it completely #376

Description

@anshul23102

Summary

checkLockout / recordFailedAttempt in userAuth.controller.js gate failed attempts per user account. An attacker using a botnet or simple IP rotation can run unlimited password-spray attacks against any email address without ever triggering the lockout.

Impact

  • Credential stuffing and password spray attacks succeed unimpeded.
  • Accounts with weak or reused passwords are compromised silently.

Suggested Fix

Implement a two-dimensional rate limit:

  1. Per-account lockout after N failures (already present) - keep this.
  2. Per-IP rate limiting via express-rate-limit on the /login route (missing).
  3. Optional: CAPTCHA challenge after 3 failures.
const loginLimiter = rateLimit({
  windowMs: 15 * 60 * 1000,
  max: 20,
  keyGenerator: (req) => req.ip,
});
router.post('/login', loginLimiter, loginController);

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions