post-exploiting-microsoft-graph-with-graphrunner
它能做什么
这个工具可以在获得初始访问权限之后,帮你探索和控制 Microsoft 365 系统(如邮件和文件)。它可用于收集信息、保持访问,甚至提升系统内的权限。
适用场景
- ✓在获得 Microsoft 365 系统的授权访问之后。
- ✓检查权限和安全策略时。
- ✓演示攻击者如何保持访问或提升权限时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/post-exploiting-microsoft-graph-with-graphrunner/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想探索 Microsoft 365 系统,找到敏感信息并保持访问权限。”
每周 5 个新技能,1 分钟读完。
工作原理
该工具通过 Microsoft Graph API 与系统交互。它会伪装成正常流量,从而执行窃取数据、创建虚假访问权限或把成员添加到群组等操作。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Post-Exploiting Microsoft Graph with GraphRunner
Authorized use only: GraphRunner performs offensive actions against live Microsoft 365 / Entra ID tenants — deploying OAuth apps, cloning groups, adding members, and reading mailboxes, SharePoint, and Teams. Run it only against tenants you own or are explicitly authorized in writing to test. Unauthorized use is illegal.
Overview
GraphRunner (Beau Bullock / Black Hills Information Security) is a PowerShell post-exploitation toolset built entirely on the Microsoft Graph API. Given a foothold token, it performs recon, establishes persistence, escalates privilege, and pillages M365 data — all through Graph, which blends in with normal traffic and bypasses many endpoint controls. It is the natural follow-on to credential/token theft (e.g., device-code phishing or ROADtools): once you hold Graph access, GraphRunner operationalizes it.
The toolset is a single PowerShell module (GraphRunner.ps1) exposing dozens of functions grouped by purpose:
- Authentication —
Get-GraphTokens(device-code login),Invoke-RefreshGraphTokens,Invoke-AutoTokenRefresh,Invoke-ImportTokens,Invoke-RefreshToSharePointToken. - Recon & Enumeration —
Invoke-GraphRecon(tenant/user permission summary),Invoke-DumpCAPS(conditional-access policies),Invoke-DumpApps(app registrations / consent grants),Get-AzureADUsers,Get-SecurityGroups,Get-UpdatableGroups,Get-DynamicGroups,Invoke-SearchUserAttributes,Invoke-GraphOpenInboxFinder,Find-PermissiveCalendars. - Persistence —
Invoke-InjectOAuthApp(deploy a malicious OAuth app for consent-grant persistence),Invoke-CreateInboxForwardingRule. - Privilege Escalation —
Get-UpdatableGroups,Invoke-AddGroupMember,Invoke-SecurityGroupCloner,Invoke-InviteGuest. - Pillage / Data Search —
Invoke-SearchMailbox,Invoke-SearchSharePointAndOneDrive,Invoke-SearchTeams,Get-TeamsChat,Invoke-DriveFileDownload. - Master runner —
Invoke-GraphRunnerruns an automated recon-and-pillage pass;List-GraphRunnerModulesprints all modules.
This maps to MITRE ATT&CK T1098 — Account Manipulation: GraphRunner manipulates accounts, groups, and OAuth grants (adding members, injecting apps, cloning groups, inviting guests) to maintain and escalate access in the cloud identity plane.
When to Use
- After obtaining a valid Microsoft Graph access/refresh token during an authorized M365/Entra engagement.
- When mapping tenant permissions, conditional-access policies, and OAuth app exposure.
- When establishing cloud persistence via OAuth consent grants or inbox forwarding (in scope).
- When demonstrating privilege escalation through updatable/dynamic groups.
- When searching mailboxes, SharePoint/OneDrive, and Teams for sensitive data to evidence impact.
Prerequisites
- Written authorization and scope for the target tenant.
- A Graph token foothold (from
Get-GraphTokensdevice-code login, or imported tokens). - PowerShell 5.1+ or PowerShell 7 (cross-platform).
# Clone and import the module
git clone https://github.com/dafthack/GraphRunner.git
cd GraphRunner
Import-Module .\GraphRunner.ps1
# List every available module
List-GraphRunnerModules
Objectives
- Authenticate to Microsoft Graph and maintain tokens via refresh.
- Enumerate tenant users, groups, CA policies, and OAuth apps.
- Identify updatable groups and demonstrate privilege escalation.
- Establish persistence via an injected OAuth app and/or inbox forwarding rule.
- Search mailboxes, SharePoint/OneDrive, and Teams for sensitive content.
MITRE ATT&CK Mapping
| ID | Tactic | Official Technique Name | Role in this skill |
|---|---|---|---|
| T1098 | Persistence | Account Manipulation | Add group members, clone groups, invite guests to retain/escalate access |
| T1098.003 | Privilege Escalation | Account Manipulation: Additional Cloud Roles | Adding members to privileged/updatable groups |
| T1528 | Credential Access | Steal Application Access Token | Get-GraphTokens device-code token acquisition |
| T1087.004 | Discovery | Account Discovery: Cloud Account | Get-AzureADUsers, Invoke-SearchUserAttributes |
| T1114.002 | Collection | Email Collection: Remote Email Collection | Invoke-SearchMailbox over Graph |
| T1606.002 | Credential Access | Forge Web Credentials: SAML/OAuth | Invoke-InjectOAuthApp consent-grant persistence |
…
常见问题
使用这个工具需要许可吗?
需要。在任何系统上使用该工具,都必须获得明确的书面授权。未经授权使用是违法的。
什么是“Graph token”?
它是一种特殊的访问密钥,让工具无需传统密码,就能与邮件、文件等 Microsoft 服务进行交互。
这个工具会影响哪些系统?
它在 Microsoft 365 和 Entra ID(原 Azure AD)生态系统内运行,会影响 Outlook、SharePoint、Teams 等服务。
详情
作者的原始描述
Runs GraphRunner, a PowerShell post-exploitation toolset built on the Microsoft Graph API, to perform tenant recon, establish persistence (OAuth app injection, inbox rules), escalate privilege via group manipulation, and pillage mailboxes, SharePoint, and Teams data from a foothold Graph token. Use during authorized red-team engagements against Microsoft 365/Entra ID tenants once you hold a Graph
热度
- GitHub 星标
- 35k
- 排名
- #8341
- 许可证
- 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帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。