Brute Force、Password Spraying 与 Credential Stuffing
区分单账号多密码的 brute force、单弱密码多账号的 password spraying、泄漏账号密码对跨站复用的 credential stuffing,并解释为什么三者需要不同的计数维度、检测信号和 MFA/限流策略。
[!info] related notes
- 所属 MOC: 安全 MOC
- Password Policy: Password Policy
- Blocklist: Breached Password Blocklist
- Throttling: Authentication Throttling & Account Lockout
- MFA: Password 与 MFA 的安全边界
- Password Manager: 密码管理器
Brute Force、Password Spraying 与 Credential Stuffing
一句话关系
这三种攻击都在尝试获得有效登录,但攻击维度不同。
Brute Force: one account → many candidate passwords
Password Spraying: one/few weak passwords → many accounts
Credential Stuffing: breached username/password pairs → another service
Brute Force
典型:
alice@example.com → password1 → password2 → password3 → …
目标是:
猜中某一个账号的 password。
主要信号:
- 单账号连续失败;
- 单来源高频;
- 单设备对一个账号大量尝试。
防御重点:
- account-level throttling;
- rate limiting;
- password hashing;
- blocklist;
- MFA。
Password Spraying
典型:
Password123! → alice → bob → carol → david → …
攻击者故意:
每个账号只试很少次数。
这样可以绕过:
5 failures on one account → lock
这种简单策略。
主要信号:
- 同一密码模式难以直接看到,因为 server 不应记录 plaintext;
- 同一来源/设备尝试大量账号;
- 大量账号出现低频失败;
- username enumeration pattern;
- 相似时间窗口内横向扫描。
所以只做 per-account lockout 不足。
Credential Stuffing
攻击者已经拥有其他 breach 的:
username/password
然后直接测试:
site A leaked pair → site B login
如果用户复用了 password,就可能一次成功。
这不是“猜密码”意义上的 brute force。
攻击者往往:
- 每个账号只尝试 1~2 个高概率 pair;
- 使用大量 proxy/IP;
- 模拟正常浏览器;
- 控制速率避免触发阈值。
因此简单 IP rate limit 很容易被绕过。
为什么 Password Reuse 是核心
Credential stuffing 的经济模型来自:
same email/password → reused across services
所以重要防线包括:
- password manager;
- unique passwords;
- breached-password blocklist;
- MFA / passkey;
- anomaly detection。
计数维度
认证防御不应该只有:
IP counter
至少可能组合:
- account / user id;
- IP;
- subnet / ASN;
- device/browser fingerprint;
- credential pair signal;
- number of accounts touched by one source;
- number of sources touching one account;
- time window。
不同 attack pattern 需要不同 dimension。
Account Enumeration
攻击者如果可以先判断:
alice exists bob does not exist
credential stuffing / spraying 会更高效。
因此登录、forgot-password 等接口通常需要:
- consistent public error;
- 尽量减少明显 timing difference;
- 内部仍保留可观察安全日志。
MFA
MFA 对 password-related account takeover 是重要纵深防御。
如果 password 已通过 credential stuffing 被验证:
password valid → MFA still required → attacker still lacks second factor
但:
- SMS/TOTP 可能被 phishing;
- push 可能被 fatigue;
- recovery/reset 可能绕过 MFA。
因此 MFA 不是“打开一个开关就结束”。
Passkey / WebAuthn
Passkey/WebAuthn 使用站点绑定的公钥凭证,不依赖用户在多个站点复用同一个共享 password。
因此它从根上弱化了 credential stuffing 的主要输入:
reused shared secret
同时 phishing resistance 通常也比传统 OTP 更强。
CAPTCHA / JS Challenge
CAPTCHA、JS challenge、headless detection 可以提高 bot attack 成本。
但它们是:
defense in depth
不是主要身份安全边界。
攻击者可能:
- outsource CAPTCHA;
- use real browser automation;
- rotate devices/IP。
监控指标
建议分别观察:
- failures per account;
- unique accounts per IP/device;
- unique IPs per account;
- MFA challenge rate;
- MFA failure after valid password;
- login success after many failures;
- blocked breached-password creation;
- known bad IP/ASN signal。
这样才能识别低速横向 spraying 和分布式 stuffing。
对比表
| Attack | Password Dimension | Account Dimension | 典型特征 |
|---|---|---|---|
| Brute Force | many | one/few | 单账号纵向猜测 |
| Password Spraying | one/few common | many | 低频横向扫描 |
| Credential Stuffing | leaked known pairs | many | 利用跨站密码复用 |
常见误区
所有攻击都叫暴力破解
会导致错误的计数和响应策略。
per-account 5 次锁定能防所有攻击
Spraying 正是为了避开这种阈值。
IP rate limit 能防 Credential Stuffing
攻击者可以使用 distributed proxy/botnet。
Password hashing 能防 Credential Stuffing
Hashing 主要防 database breach 后的 offline guessing;无法阻止攻击者拿真实 password pair 来在线登录。
学习检查
- Brute Force、Password Spraying、Credential Stuffing 的攻击维度有什么差异?
- 为什么 spraying 能绕过简单 per-account lockout?
- 为什么 credential stuffing 不主要依赖“猜”密码?
- 为什么单纯 per-IP rate limit 不足?
- password hashing 为什么无法直接阻止 credential stuffing?
- MFA 和 Passkey 分别怎样改变攻击者成本?
- 设计一组 metrics,怎样区分单账号 brute force 与低速 password spraying?