Prompt
How do I use a WAF for credential stuffing protection?
Latest observation
A WAF can help with credential stuffing, but it works best as part of a layered defense. Credential stuffing is mostly about high-volume automated login attempts using stolen usernames/passwords, so the WAF’s job is to detect, slow, and block suspicious auth traffic without breaking real users.
What to do with a WAF
1) Protect login, signup, password reset, and MFA endpoints
Put WAF rules specifically on:
/login/api/auth/*/signin/password-reset/mfa/*
These endpoints are the main targets.
2) Rate limit by IP, account, and device signals
Use WAF rate limiting to throttle:
- Requests per IP
- Requests per username/email
- Requests per session/device fingerprint
- Requests per ASN or geo region if abuse is concentrated there
Important: credential stuffing often uses distributed IPs, so IP-only limits are not enough.
3) Add bot detection / automation signals
Many WAFs can score traffic using signals like:
- Missing or suspicious browser headers
- Headless browser behavior
- Unusual request timing
- Repeated failed logins across many accounts
- No cookies / JavaScript execution
- TLS or fingerprint anomalies
Block, challenge, or step-up verify suspicious requests.
4) Challenge suspicious traffic
For borderline cases, use:
- CAPTCHA
- JavaScript challenge
- Proof-of-work / managed challenge
- Email or MFA step-up on risk
Use challenges selectively so you don’t hurt legit users.
5) Block credential-stuffing patterns
Common indicators:
- Many login failures from one IP or subnet
- One IP trying many usernames
- Many usernames attempted from one user agent
- High failure rate with low success rate
- Abnormal login velocity
- Login attempts immediately after leaked-credential events
Build WAF rules for these patterns.
6) Use allowlists carefully
If you have trusted enterprise partners, internal VPN ranges, or known good automation, create narrow allowlists. Avoid broad allowlists that attackers can abuse.
7) Watch for account-level abuse
A lot of credential stuffing looks normal at the request level but abnormal at the account level. Feed the WAF with:
- Failed login counts per account
- Recent password reset activity
- MFA fatigue events
- Prior breach indicators
- Device reputation
Then block or step up verification when an account looks targeted.
8) Log and tune aggressively
You’ll need to tune the WAF to avoid false positives:
- Review blocked/challenged requests
- Track login success rate after challenge
- Watch for legitimate users on shared IPs, NAT, mobile networks
- Adjust thresholds by endpoint and traffic pattern
Best-practice rule examples
If your WAF supports custom rules, useful ones include:
- “If
/logingets > N failures from same IP in 5 minutes, challenge” - “If same username is attempted from > M IPs in 10 minutes, step up”
- “If request lacks normal browser headers, block/challenge”
- “If
/password-resetis hit too often by same account or IP, rate limit” - “If geo/ASN reputation is poor and auth failure rate is high, block”
Important limitation
A WAF alone will not stop credential stuffing if you only rely on:
- IP blocking
- Static signatures
- Simple request patterns
Attackers rotate IPs, use residential proxies, and mimic browsers. For strong protection, combine the WAF with:
- MFA
- Bot management
- Password breach checking
- Risk-based authentication
- Device fingerprinting
- Login anomaly detection
- Credential screening against known breached passwords
A practical deployment model
- Monitor mode first: collect data on login traffic.
- Enable rate limits on auth endpoints.
- Turn on bot/challenge rules for suspicious traffic.
- Add account-based controls and step-up auth.
- Tune continuously based on false positives and attack trends.
If you want, I can also give you:
- a sample WAF rule set for Cloudflare/Akamai/AWS WAF/F5
- a credential stuffing detection checklist
- or a recommended architecture for protecting login flows.