Application Security

Hit by Credential Stuffing? How to Defend Your Login Endpoint

Credential stuffing looks like real failed logins, so IP limits fail. Defend with Turnstile, ASN-based counting, Bot Management and breach checks.

Short answer: Credential stuffing replays username-and-password pairs leaked from other sites against your login endpoint. It is hard to stop because the traffic looks human: the credentials are real, the IPs come from residential proxy pools, and the request rate is deliberately low. IP rate limiting and account lockouts do not cover it. Workable defenses stack four layers: a human-verification step on the login page (Turnstile is free), rate limiting rules that count by ASN or fingerprint instead of IP, Bot Management to score automated clients, and application-side MFA plus breached-password checks. When an attack is underway: raise verification friction first, tighten rules second, and reach for broad IP blocking last.

First, the differences: stuffing, brute force and spraying

All three hit the login endpoint, but the material and the pattern differ, and so does the defense:

Method Password source Traffic pattern Defense focus
Credential stuffing Real credential pairs leaked from other sites High volume but spread out; failure rate tracks dictionary quality Detect automated clients; check breached passwords
Brute force Exhaustively generated combinations High frequency from few sources, near-100% failure IP rate limiting works well here
Password spraying Weak passwords like “123456” tried across many accounts One or two attempts per account to dodge lockouts Password policy; aggregate by ASN

Cloudflare observed requests using exposed credentials at a rate above 12,000 per minute during large brute-force attacks. Even if one in a thousand lands, that is over a hundred compromised accounts per day on a platform with a million users. Stuffing scales not because it is technically sophisticated but because of password reuse: one breach, many doors.

Why stuffing is hard to stop: 71% of login traffic is automated

One number from Cloudflare’s bot research is worth memorizing if you ship a login form: roughly 44% of global web traffic is automated, but 71% of traffic to login endpoints is automated. Close to three out of four requests your login page receives were never made by a person in a browser.

Conventional defenses fail against this for three reasons:

  • The credentials are real. Stuffing requests carry valid username-and-password pairs from actual breaches. Your application does not see a malformed request; it sees an ordinary failed login. Input validation does nothing here.
  • The IPs are residential proxies. Proxy pools keep per-IP volume low and mix with real users behind corporate and mobile networks. IP rate limiting either misses the attack or locks out large numbers of genuine customers.
  • The rate is deliberately low. “Low and slow” is stuffing etiquette: a few attempts per IP per minute across tens of thousands of IPs. No purely rate-based threshold fires.

That is why defending against stuffing means changing the counting key and the detection signal, not lowering thresholds.

The attack chain and where to intervene

Leaked pairs from other sites Proxy pool rotating IPs Stuffing script mimics a browser Your login endpoint valid creds, hard to tell Edge layer (Cloudflare) Turnstile verification Rate limits (by ASN / JA3/JA4) Bot Management score Stops automated clients and abnormal patterns — no password checking involved Application layer (yours) MFA / Passkeys Breached-password checks Login anomaly monitoring Session management Stops "correct credentials, wrong person" — information the edge cannot see With both layers in place, even a correct leaked pair cannot get through the second door

The key is the boundary: the edge layer stops requests that look automated; the application layer stops credentials that are correct but not the owner’s. Remove either one and the attacker goes around the other.

Layer one: human verification on the login page

Turnstile is the highest-value first step: free, three modes (managed, non-interactive, invisible), no puzzles for real users, and almost no friction on a genuine login. It checks whether the browser environment making the request looks like a real browser before the credentials are ever submitted — and stuffing scripts, proxy pools notwithstanding, struggle to reproduce that environment on every residential device.

Two implementation points that matter:

  • Validate the token server-side with Siteverify. Embedding the widget without backend validation is the most common integration mistake, and it protects nothing.
  • Grade the failure action. Hard-rejecting every failed challenge hurts some real users (very old browsers, heavy privacy extensions). A safer default is to fall back to an interactive challenge or step-up verification.

Layer two: rate limiting — stop counting by IP

IP-based rate limiting works on brute force and nearly never on stuffing. Making it work for stuffing means switching the counting key to signals the attacker cannot rotate cheaply:

  • Count by ASN. Stuffing clusters on hosting ASNs. A low per-ASN threshold beats a global one.
  • Scope the rule to the login path. Keep it separate from site-wide rules so global thresholds never mix legitimate traffic with the attack.
  • Use composite keys. Header characteristics, missing cookies and JA3/JA4 fingerprints (available on Enterprise) let you aggregate “the same batch of scripts” into one counter instead of scattering it across a proxy pool.

Mind the boundary we covered in the rate limiting article: counters are scoped per data centre and lag by a few seconds, so rate limiting is a load-shedding tool, not a quota system. When stuffing runs deliberately slow, the rule may never fire at all — which is exactly why layer three exists.

Layer three: Bot Management and credential checks

Bot Management is the layer aimed squarely at stuffing, because it does not judge the password — it judges who is making the request:

  • A 1–99 bot score. A machine learning model scores every request; a rule such as “login path + bot score below 30 → managed challenge” stops automated clients before they ever submit credentials.
  • JA3/JA4 fingerprints. Stuffing scripts reuse the same HTTP client libraries, so fingerprints cluster tightly. Aggregating by fingerprint identifies tens of thousands of distributed IPs as one campaign.
  • Exposed Credentials Check. Compares login-request credentials against known breach corpora; matches trigger a challenge or a log entry. This attacks the stuffing supply directly.
  • Account Abuse Protection. An account-level view of login attempts: whether one account shows failures across unusually many IPs, whether attempts hit leaked-credential matches, whether failures concentrate on specific ASNs. It turns “which accounts are affected” from a guess into a query.

Four things the application layer must do itself

However strong the edge is, it cannot know what a credential pair means inside your system. Four things remain yours:

  1. MFA or passkeys. Stuffing targets single-factor systems. Even a correct hit stops at the second factor — this is the fundamental defense, with no substitute.
  2. Breached-password checks. Compare new passwords against breach corpora (or use a k-anonymity scheme) at set-password time, shrinking the fraction of users whose credentials are valid stuffing material.
  3. Login anomaly monitoring. One account failing from many IPs, many accounts failing from one ASN, elevated overnight failure rates — these aggregates need their own dashboard in your application, not just edge logs.
  4. Session management. After a suspicious login, be able to revoke every session for that user, and log out all devices on password change. How fast you contain a successful stuffing hit depends on this.

The response order when stuffing is underway

Once you have confirmed a stuffing campaign (not spraying, not your own bug), work in this order:

  1. Raise verification friction first; do not start with IP blocks. Put a managed challenge on the login path or step Turnstile up a mode — reversible, low false positives, stops the bleeding.
  2. Ship targeted rules in observe mode. Write rules by ASN, fingerprint or bot score, watch the false-positive rate with a log/challenge action, then tighten to block once clean.
  3. Scope the affected accounts. Using anomaly metrics and (if enabled) Account Abuse Protection, list accounts with leaked-credential matches plus multi-IP failures.
  4. Contain. Force password resets, revoke sessions, require step-up verification for those accounts; if they can move money or export data, review their activity logs individually.
  5. Review the material. After the attack dies down, ask: what share of your users’ passwords overlap known breach corpora? Do you need a breached-password policy now?

The anti-pattern is worth recording too: skipping step one and blocking large IP ranges is the most common false-positive source in stuffing response — real users behind shared egress get blocked alongside the attacker, and support tickets outweigh the attack.

FAQ

Is credential stuffing the same as a data breach? No. Stuffing replays credentials leaked elsewhere against your login endpoint; your database is never touched. A breach means your own user database was stolen. Stuffing is defended on the login path (this article); breaches are defended through data access controls and encryption. A mature system needs both.

Why doesn’t locking an account after three failed passwords stop stuffing? Lockouts count per account, and stuffing’s signature is exactly one or two attempts per account — tens of thousands of pairs spread across tens of thousands of accounts never triggers a lockout. Lowering the lockout threshold turns the feature into a denial-of-service lever for attackers. Lockouts suit brute force; stuffing needs ASN/fingerprint aggregation and human verification.

Is Turnstile free? What plan does it require? The free tier costs $0 and includes all three modes with minimal friction for real users; Enterprise adds custom terms and higher-grade support. On any plan, server-side Siteverify is mandatory — frontend-only embedding protects nothing.

Why is IP rate limiting ineffective against stuffing? Two reasons: residential proxy pools keep per-IP volume below any usable threshold, and shared egress (corporate, campus, mobile networks) carries real users, so low thresholds lock them out too. Switch the counting key instead — ASN, header characteristics, JA3/JA4 fingerprints — signals an attacker cannot rotate the way they rotate IPs.

Some accounts are already compromised. What now? Immediately force password resets for those accounts, revoke all sessions, require step-up verification at next login, and audit post-compromise activity for exports, money movement or permission changes. Then work upstream: did those users’ passwords overlap breach corpora? That answer decides whether you need breach checks for everyone.

What plan do I need to stop stuffing? Layer by layer: Turnstile and basic rate limiting work on any plan — start there. NAT support in rate limiting arrives on Business; ASN, header, cookie, JA3/JA4 and JSON-field counting keys require Enterprise; bot score rules, Exposed Credentials Check and Account Abuse Protection are part of Enterprise Bot Management. But MFA, passkeys, breached-password checks, session management and application-side monitoring must be built on any plan — they are the last door.

Run the same check on your domain

Enter a domain and see its DNS hosting, mail authentication and Cloudflare status in 30 seconds. Free, public records only.

Public DNS records only. No intrusive scanning. · Used only to send this diagnosis — no marketing blasts.

Sources

Official Cloudflare documentation. Where this article mentions availability, quotas or limits, these pages are the source of truth. Cloudflare features change over time — confirm what is visible in your dashboard before committing to a design.

← Back to articles

Authorized Cloudflare Partner

Making an architecture decision for overseas markets?

Enterprise tier selection, architecture consulting, risk assessment — tell us the scenario and we will map a concrete path.

As a Cloudflare partner, we provide:

Book a consultation