返回更新列表
新发布Jul 28, 2026

CredSpy v1.1.0

通过公共 GetCredentialType API 进行 Entra ID 用户枚举和认证方法发现

分享

PyPi Version Python Version GitHub Sponsors Twitter LinkedIn

CredSpy

使用公开的 GetCredentialType API,枚举电子邮件地址的 Microsoft Entra ID 身份验证方法。这与 Microsoft 登录页面在输入用户名时使用的端点相同。与大多数使用 GetCredentialType 方法的工具不同,CredSpy 还会显示现有账户支持的身份验证方法。

适用于安全评估:用户枚举、首选身份验证方法发现,以及识别使用密码、远程 NGC(例如无密码推送通知)、FIDO2/通行密钥或证书身份验证的账户。

目录

安装

需要 Python 3.10+。

pipx(推荐):

# Install pipx (skip this if you already have it)
apt install pipx
pipx ensurepath
# From PyPI (recommended)
pipx install credspy

# Or from GitHub
pipx install git+https://github.com/RedByte1337/CredSpy.git

# From a local clone
git clone https://github.com/RedByte1337/CredSpy.git
cd CredSpy
pipx install .

pip

pip install .
# or run without installing
pip install -r requirements.txt
python credspy.py ...

安装后,可在任意位置运行 credspy

credspy -h

用法

# Single email
credspy [email protected]

# File of emails (one per line, # for comments)
credspy emails.txt

# Through a proxy (SSL verification disabled for MITM tools)
credspy emails.txt --proxy http://127.0.0.1:8080

# Export results to CSV
credspy emails.txt --csv results.csv

# Save filtered email lists (combinable)
credspy emails.txt \
  --save-existing existing.txt \
  --save-ngc ngc.txt \
  --save-password-preferred password-preferred.txt

选项

FlagDescription
target电子邮件地址或文本文件路径
--proxy URL通过代理路由所有流量;禁用 SSL 验证(格式:http://127.0.0.1:8080
--no-color禁用彩色终端输出
--csv FILE将结果写入 CSV
--save-existing FILE保存存在的电子邮件
--save-ngc FILE保存支持 RemoteNGC(例如无密码推送通知)的电子邮件
--save-password-preferred FILE保存将密码作为首选方法的现有电子邮件
--skip-ngc禁用 RemoteNGC 检查(当 RemoteNGC 是首选方法时避免推送通知;这也会禁用 NGC 发现)

[!IMPORTANT] 在极少数情况下,如果用户将 RemoteNGC 设置为主要方法,那么 Microsoft 会在枚举期间立即向 Authenticator 应用触发 RemoteNGC 推送通知。 避免这种情况的唯一方法是在 GetCredentialType 请求中将 isRemoteNGCSupported 设置为 false。这样做的后果是,响应将不再返回是否支持 RemoteNGC。 如果您想避免发送任何自动通知,并且不需要 RemoteNGC 发现,请使用 --skip-ngc 标志。

如果任何输出文件已存在,系统会提示您确认覆盖(Y/n)。

输出

每检查一个电子邮件,结果即会流式输出到终端:

[email protected]       | Preferred: Fido (7)       | Supported: Password, RemoteNGC (PushNotification), Fido (Count: 3)
[email protected]   | IfExistsResult: NotExist (1)
[email protected]         | Preferred: Password (1)   | Supported: Password, RemoteNGC (PushNotification)
[email protected]         | Preferred: RemoteNGC (2)  | Supported: Password, RemoteNGC (PushNotification)
[email protected]           | Preferred: Fido (7)       | Supported: Password, Fido (Count: 5), Certificate

如果电子邮件账户存在,邮件地址后的第一列将显示用户的首选身份验证方法。最后一列将列出其他支持的身份验证方法,例如 Password、RemoteNGC、Fido(=PassKeys)和 Certificate 身份验证。

在准备钓鱼攻击时,所有这些信息都非常值得考虑。

对于 Fido 身份验证,会显示 Microsoft 返回的 FidoParams 中 AllowList 的条目数。这可以用作了解用户已注册多少 Fido 身份验证方法的指标。不过,它似乎也包含已删除且不再关联到账户的 Fido 密钥。

最后会打印一份摘要:

--- Summary ---
Exists: 6/7
Throttled: 0/7
Preferred: Fido 3/6, Password 2/6, ...
Supported: Password 6/6, RemoteNGC 1/6, Fido 3/6, Certificate 2/6
DomainType: Managed 6/6

--- Output files ---
CSV (results.csv): 7 entries

CSV 列

Email, Exists, PreferredType, HasPassword, RemoteNGC, HasFido, HasCertAuth, DomainType

  • Exists — 枚举名称(ExistsNotExist、……)
  • RemoteNGC — 已知时为 PushNotification / ListSessions,否则为 True/False

工作原理

  1. 从 Microsoft OAuth 授权页面获取会话上下文(sCtx
  2. 将每个用户名 POST 到 login.microsoftonline.com/common/GetCredentialType
  3. 解析凭据标志并打印/导出结果

无需身份验证。这使用与登录 UI 相同的未认证流程。

免责声明

本工具仅供授权安全测试和研究使用。仅可对您拥有或已获得明确书面测试许可的租户和账户使用。作者不对滥用行为负责。

分类