| name | hunting-credential-stuffing-attacks |
| description | 通过分析认证日志中的登录速率异常、ASN 多样性、密码喷洒(password spray)模式和失败登录的地理分布,检测凭据填充(credential stuffing)攻击。对 Splunk 或原始日志数据进行统计分析。适用于调查账户接管活动或为认证滥用构建检测规则。
|
| domain | cybersecurity |
| subdomain | security-operations |
| tags | ["hunting","credential","stuffing","attacks"] |
| version | 1.0 |
| author | mahipal |
| license | Apache-2.0 |
狩猎凭据填充攻击
使用说明
分析认证日志,通过识别分布式登录失败、高 IP 多样性和可疑 ASN 分布等模式,检测凭据填充(credential stuffing)攻击。
import pandas as pd
from collections import Counter
df = pd.read_csv("auth_logs.csv", parse_dates=["timestamp"])
ip_per_account = df[df["status"] == "failed"].groupby("username")["source_ip"].nunique()
accounts_under_attack = ip_per_account[ip_per_account > 50]
关键检测指标:
- 每个失败用户名的唯一来源 IP 数量高
- 跨多个账户的成功率低(< 1%)
- 来自云服务/代理提供商的 ASN 集中
- 地理位置不可能(同一账户,位置距离极远)
- 分布式 IP 中 User-Agent 的一致性
示例
spray = df[df["status"] == "failed"].groupby(["source_ip", "password_hash"]).agg(
accounts=("username", "nunique")).reset_index()
sprays = spray[spray["accounts"] > 10]