← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Credential Stuffing

security CWE-307 OWASP A7:2021 CVSS 8.1 PHP 5.0+ Intermediate
debt(d7/e5/b5/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The term's detection_hints.automated is 'no' and the code_pattern describes absence of protective measures rather than presence of vulnerable code. No automated tools from the term's detection_hints.tools list exist to flag this — you need security review or runtime monitoring of anomalous login patterns to detect vulnerability to credential stuffing.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix requires implementing rate limiting (middleware/infrastructure), anomaly detection (logging/alerting systems), breach-list integration (external API calls), and potentially MFA — this spans authentication logic, middleware, monitoring, and possibly user notification systems. Not a one-liner, but not architectural rework either.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Per applies_to, this affects web and api contexts — every login endpoint needs these protections. Rate limiting, breach-list checks, and anomaly detection become ongoing maintenance concerns that affect how authentication is designed and monitored. However, it doesn't reshape the entire system architecture.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap / documented gotcha most devs eventually learn' (t5). The misconception field explicitly states developers wrongly believe 'strong password policies prevent credential stuffing' — but stuffing uses valid credentials from breaches, making password complexity irrelevant. This is a well-documented security gotcha that most developers learn after studying authentication security, but it contradicts the intuitive assumption that 'strong passwords = secure logins'.

About DEBT scoring →

Also Known As

credential replay breached password attack list attack

TL;DR

Automated injection of username/password pairs from previous data breaches to gain access to accounts where users reused credentials.

Explanation

Credential stuffing exploits password reuse across services. Attackers acquire breach databases (billions of credentials are publicly available), then use automated tools to test them at scale against target login endpoints. Success rates of 0.1–2% on large lists still yield thousands of compromised accounts. Defences include: multi-factor authentication (makes stolen passwords alone insufficient), rate limiting and CAPTCHA on login, breached-password detection (checking against Have I Been Pwned API), device fingerprinting, and anomaly detection on login patterns.

Common Misconception

Strong password policies prevent credential stuffing. Stuffing uses valid credentials from other breached sites — the password is already correct, so complexity rules are irrelevant. MFA is the real defence.

Why It Matters

Billions of username/password pairs from previous breaches are freely available — automated tools test them against every major site, succeeding wherever users reuse passwords.

Common Mistakes

  • No rate limiting or IP throttling on the login endpoint.
  • Not detecting or alerting on login attempts from IPs known to be associated with credential stuffing.
  • Not prompting users to change passwords found in known breach databases (Have I Been Pwned API).
  • No multi-factor authentication option — a reused password alone grants access.

Code Examples

✗ Vulnerable
// Login with no rate limiting or breach detection:
if ($user && password_verify($pass, $user->hash)) {
    $_SESSION['user'] = $user->id;
    header('Location: /dashboard');
}
✓ Fixed
// Defences against credential stuffing (leaked username/password lists)

// 1. MFA — stolen credentials alone don't work

// 2. Rate limit per IP + per account
\$key = 'login_attempts:' . \$email . ':' . date('YmdHi');
if (\$redis->incr(\$key) > 5) {
    \$redis->expire(\$key, 60);
    return response()->json(['error' => 'Too many attempts'], 429);
}

// 3. Check passwords against HaveIBeenPwned API (k-anonymity model)
\$sha1   = strtoupper(sha1(\$password));
\$prefix = substr(\$sha1, 0, 5);
\$suffix = substr(\$sha1, 5);
\$resp   = file_get_contents("https://api.pwnedpasswords.com/range/\$prefix");
if (str_contains(\$resp, \$suffix)) {
    return 'This password has appeared in a data breach. Please choose another.';
}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 28
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 2 pings F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 1 ping S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 0 pings S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 0 pings F
No pings yet today
No pings yesterday
Amazonbot 9 Perplexity 6 Unknown AI 3 SEMrush 3 Ahrefs 2 Google 1
crawler 22 crawler_json 1 pre-tracking 1
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: High
⚡ Quick Fix
Implement per-IP + per-account rate limiting, anomaly detection on login geography/device, and prompt users whose emails appear in breach lists
📦 Applies To
PHP 5.0+ web api
🔗 Prerequisites
🔍 Detection Hints
Login endpoint accepting credentials with no device fingerprinting or breach-list check
Auto-detectable: ✗ No
⚠ Related Problems
🤖 AI Agent
Confidence: Medium False Positives: Medium ✗ Manual fix Fix: High Context: File Tests: Update
CWE-307 CWE-1216

✓ schema.org compliant