hunting-saas-sso-token-abuse
它能做什么
这个工具可以帮你查找用户账号是否已经失陷。它会寻找迹象,判断是否有人在未经授权的情况下,使用他人的凭据(比如访问“令牌”,token)登录在线服务,即使本人并没有登录。
适用场景
- ✓当你怀疑攻击者正在使用被盗凭据访问服务时。
- ✓在调查“不可能的异地登录”告警时(即同一账号在很短时间内从相距很远的地方登录)。
- ✓检查攻击者在遭受攻击后,是否在在线服务内部横向移动。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/hunting-saas-sso-token-abuse/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“排查可能绕过多因素认证的被盗会话令牌的使用情况。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会对比来自不同服务(例如 Microsoft Entra ID 和 Okta)的登录记录。它会寻找异常模式,比如同一个登录会话出现在相距很远的地点,或者来自可疑网络。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Hunting SaaS SSO Token Abuse
Overview
Adversaries increasingly bypass MFA not by defeating it but by stealing the artifacts issued after a successful authentication — session cookies, OAuth access/refresh tokens, and Primary Refresh Tokens (PRTs). With a stolen token an attacker replays the existing session ("pass-the-cookie" / token replay), inheriting the victim's authenticated state across federated SaaS without ever prompting for credentials or MFA. Mandiant's M-Trends reporting and Microsoft/Okta incident data both highlight token theft as a dominant cloud lateral-movement technique, mapped to MITRE ATT&CK T1550.001 Use Alternate Authentication Material: Application Access Token.
Detection relies on correlating identity telemetry rather than watching for failed logins. In Microsoft Entra ID the key tables are SigninLogs (interactive), AADNonInteractiveUserSignInLogs (where replayed cookies/refresh tokens commonly surface), and AADServicePrincipalSignInLogs. Entra now exposes linkable identifiers — SessionId and UniqueTokenIdentifier — that let a hunter stitch every artifact derived from one root authentication event together and spot a single session being used from multiple IPs, ASNs, or device fingerprints. In Okta the System Log carries authentication.sso, policy.evaluate_sign_on, and user.session.start events with a deviceToken/session context; the same session token appearing from divergent IPs/user-agents is the tell. Okta Identity Threat Protection (ITP) can natively flag "suspected session hijacking."
This skill provides a hypothesis-driven hunt: baseline normal session behavior, then look for impossible travel within a single session, refresh-token reuse, token use from anomalous infrastructure (hosting/VPS ASNs), and SaaS access patterns inconsistent with the user's device. Source: MITRE ATT&CK T1550.001; Microsoft Entra ID sign-in log documentation; Okta System Log reference; Mandiant M-Trends.
When to Use
- Threat hunting for MFA-bypass via stolen tokens/cookies across Entra ID and SaaS
- Investigating an alert for impossible travel, anomalous OAuth grant, or token reuse
- Validating detection coverage for T1550.001 after a phishing/AiTM incident
- Building Sentinel/Splunk/Okta detections for session-token replay
- Post-incident hunting to scope SaaS lateral movement from a compromised identity
Prerequisites
- Entra ID sign-in logs flowing to a queryable store (Microsoft Sentinel / Log Analytics):
# Confirm the diagnostic settings export SigninLogs + non-interactive logs to a workspace az monitor diagnostic-settings list --resource \ /providers/Microsoft.aadiam/diagnosticSettings -o table - Okta System Log access via API or SIEM ingestion:
curl -s -H "Authorization: SSWS $OKTA_API_TOKEN" \ "https://<org>.okta.com/api/v1/logs?filter=eventType eq \"user.session.start\"&since=2026-06-01T00:00:00Z" - An IP enrichment source (GeoIP + ASN/hosting-provider classification)
- Read access to the SIEM (KQL for Sentinel, SPL for Splunk)
- Python 3.9+ for the helper script (
requestsfor the Okta API)
Objectives
- Baseline normal per-user session behavior (IPs, ASNs, devices, SaaS apps)
- Correlate Entra sign-in artifacts by
SessionId/UniqueTokenIdentifier - Detect a single session used from multiple IPs/ASNs (token replay)
- Detect impossible travel within one authenticated session
- Detect refresh-token reuse and anomalous OAuth grants
- Hunt Okta System Log for reused session tokens across contexts
- Produce findings and feed confirmed patterns into standing detections
MITRE ATT&CK Mapping
| ID | Name | Use in this skill |
|---|---|---|
| T1550.001 | Use Alternate Authentication Material: Application Access Token | Core technique — replaying stolen OAuth tokens/cookies |
| T1539 | Steal Web Session Cookie | The cookie theft that precedes pass-the-cookie replay |
| T1528 | Steal Application Access Token | Acquisition of OAuth tokens via phishing/illicit consent |
| T1078.004 | Valid Accounts: Cloud Accounts | Replayed tokens grant valid-account access to SaaS |
| T1098.001 | Account Manipulation: Additional Cloud Credentials | Follow-on persistence after token abuse |
Workflow
1. Correlate Entra sign-in artifacts by session
Stitch interactive, non-interactive, and SP sign-ins for one session to see the full chain.
union SigninLogs, AADNonInteractiveUserSignInLogs
…
常见问题
什么是“令牌滥用”?
指攻击者窃取合法用户的“令牌”(一种临时访问密钥),然后冒充该用户访问在线服务。这样攻击者无需密码,也无需额外的身份验证。
什么是“不可能的异地登录”?
指登录记录显示,同一用户在很短的时间内从两个地理位置相距很远的地方访问服务,这在现实中是不可能做到的。
这如何帮助找到攻击者?
通过分析登录日志,工具可以发现会话令牌是否被异常使用,比如从多个地点或不可信的网络使用,这说明令牌可能已被窃取,并被攻击者重复使用。
详情
作者的原始描述
Hunts for stolen-session and OAuth/PRT token replay (T1550.001) by correlating Microsoft Entra ID SigninLogs SessionId/UniqueTokenIdentifier fields and Okta System Log sso/session events to spot impossible travel, refresh-token reuse, and token use from anomalous ASNs. Use when hunting MFA-bypass via stolen cookies/tokens, investigating impossible-travel alerts, or scoping SaaS lateral movement af
热度
- GitHub 星标
- 35k
- 排名
- #7980
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。