الانتقال إلى المحتوى
الأمان (Security)OAuth و OIDC و JWT· 7 دقائق للقراءة

Strong Passwords Won't Stop Credential Stuffing: Rate Limiting and Login Defenses

Stuffing attacks try real passwords leaked from other sites, so strength rules don't matter. Limit attempts per IP and per account, and add MFA.

ReadIn

مقال كل يوم يفرق معاك

22 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

An online shop requires long passwords with symbols at sign-up and calls its accounts secure. The login page came from a template and lets anyone try as often as they like. One night the logs fill with sign-in attempts from many addresses, each trying a different customer's email with a different password. By morning several accounts have placed orders to new addresses. Their passwords met every rule; the customers had used them on another site that was breached.

The common misconception

The belief: strong password rules on their own protect a login endpoint from brute-force and credential-stuffing attacks.

It comes from the classic picture of an attack: someone guessing one account's password over and over. Against that, length and complexity really do help, and frameworks push them by default. ASP.NET Core Identity, for instance, "requires that passwords contain an uppercase character, lowercase character, a digit, and a non-alphanumeric character" unless you change it. With rules like that in place, the login itself looks safe.

But password rules run once, at sign-up. They say nothing about how many times the login endpoint can be called, or whether the password was already leaked somewhere else.

What actually happens

Credential stuffing replays known pairs

OWASP's Credential Stuffing Prevention Cheat Sheet defines as "Testing username/password pairs obtained from the breach of another site." Brute force tries many passwords on one account; password spraying tries one weak password on many accounts. Stuffing needs no guessing at all: if the pair works elsewhere, a strong password helps the attacker as much as a weak one.

Strength rules are a weak lever anyway

NIST SP 800-63B-4 goes further than "not enough". It notes that users answer composition rules "in very predictable ways", turning "password" into "Password1!", and says verifiers "SHALL NOT impose other composition rules". Instead, new passwords are checked against a blocklist that includes "Passwords obtained from previous breach corpuses", and online guessing is handled at the login: "Throttling is the primary defense against online attacks".

Count per client and per account

A limit per IP address stops one machine from hammering your login. It isn't enough on its own: OWASP warns that stuffing tools use proxy networks that "may defeat both IP block-lists and rate limiting, as per IP request volume may remain relatively low". That's why the Authentication Cheat Sheet says the counter of failed logins "should be associated with the account itself, rather than the source IP address". NIST caps consecutive failures on one account at "no more than 100", and allows lower limits. In ASP.NET Core Identity that counter is , with defaults of 5 failures and 5 minutes, and it only counts when you pass lockoutOnFailure: true. The login page in Identity's own template passes false.

MFA changes the outcome

Both OWASP cheat sheets call multi-factor authentication "by far the best defense against the majority of password-related attacks". A replayed password then gets the attacker to the second factor and no further. The other controls buy time and reduce noise; MFA makes a correct password insufficient.

Locking down the login endpoint

C# Program.cs
using Microsoft.AspNetCore.Identity;var builder = WebApplication.CreateBuilder(args);builder.Services.Configure<IdentityOptions>(o =>{    o.Password.RequiredLength = 12; // strong rules at sign-up...});var app = builder.Build();app.MapPost("/login", async (LoginForm form, SignInManager<AppUser> signIn) =>{    // ...but unlimited attempts, and failures never lock the account    var result = await signIn.PasswordSignInAsync(        form.Email, form.Password, isPersistent: false, lockoutOnFailure: false);    return result.Succeeded ? Results.Ok() : Results.Unauthorized();});app.Run();

The right version has two independent counters: the sliding window counts requests per client address, and Identity's lockout counts failures per account. We ran it on .NET 10 in a scratch app with an in-memory user store, behind the forwarded-headers middleware so each request could claim its own client address. First, one address tried twelve wrong passwords on one account. Then twelve addresses tried one wrong password each on a second account, and finally its real password came from a new address:

text
one IP, 12 wrong passwords: 401 401 401 401 401 401 401 401 401 401 429 42912 IPs, 1 guess each:       401 401 401 401 401 401 401 401 401 401 401 401omar locked out:            Trueright password, new IP:     401

The rate limit caught the single address and never noticed the distributed run. The account counter caught it. Note what that last line means: lockout also locked out the real owner, which is why it needs the safeguards below.

DefenseBrute force on one accountCredential stuffingMain weakness
Password composition rulesPartlyNoReused and predictable passwords still pass
Rate limit per IPYes, from one addressPartlyProxy networks spread requests thin
Failure counter per accountYesPartlyAttackers can lock real users out
Breached-password checkPartlyYes, for leaked passwordsOnly knows published breaches
Multi-factor authenticationYesYesNeeds rollout and recovery flows

How to apply it in your project

  1. Turn on the account counterPass lockoutOnFailure: true wherever passwords are checked, and choose the threshold and duration on purpose, with growing delays if you can.
  2. Rate-limit every credential endpointApply a policy to login, password reset and MFA code checks, partitioned by client address. Behind a proxy, configure forwarded headers so the address is the client's, not the proxy's.
  3. Check passwords against breaches, drop composition rulesReject new passwords found in breach lists, as NIST requires, and stop forcing symbol and digit mixes.
  4. Roll out MFA, starting with adminsOffer passkeys or an authenticator app to everyone. Where MFA can't be mandatory for all users, OWASP suggests at least requiring it for administrators.
  5. Watch the numbersTrack failed logins, lockouts and 429s per address and per account. OWASP recommends metrics for every defense, because they can reveal attacks you missed and defenses that quietly failed.

Key takeaways

  • Credential stuffing replays passwords leaked elsewhere; strength rules never see it.
  • NIST favors breached-password blocklists and throttling over composition rules.
  • Limit attempts per client address and count failures per account; each catches what the other misses.
  • Return one generic error for every failure, and guard lockout against abuse.
  • MFA is the defense that makes a correct, stolen password insufficient.

📚 المصادر

  1. Credential Stuffing Prevention Cheat Sheet — OWASP Cheat Sheet Series
  2. Authentication Cheat Sheet — OWASP Cheat Sheet Series
  3. NIST SP 800-63B-4: Authentication and Authenticator Management
  4. Rate limiting middleware in ASP.NET Core — Microsoft Learn
  5. Configure ASP.NET Core Identity — Microsoft Learn

التعليقات (0)