post-exploiting-microsoft-graph-with-graphrunner
Helps your agent exploit the Microsoft Graph API for reconnaissance and persistence in M365 environments.
What it does
This tool helps explore and control Microsoft 365 systems (like emails and files) after gaining initial access. It can be used to find information, maintain access, and even escalate your privileges within the system.
When to use it
- ✓After obtaining authorized access to a Microsoft 365 system.
- ✓To check permissions and security policies.
- ✓To demonstrate how an attacker might maintain access or escalate privileges.
Example of what to ask your AI
“I want to explore the Microsoft 365 system to find sensitive information and maintain access.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool uses the Microsoft Graph API to interact with the system. It disguises itself as normal traffic, allowing it to perform actions like stealing data, creating fake access, or adding members to groups.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill post-exploiting-microsoft-graph-with-graphrunnerOr download just the file:
curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/post-exploiting-microsoft-graph-with-graphrunner/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from 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 |
…
FAQ
Do I need permission to use this tool?
Yes, you need explicit written authorization to use this tool on any system. Unauthorized use is illegal.
What is a 'Graph token'?
It's a special access key that allows the tool to interact with Microsoft services like email and files without needing a traditional password.
What systems does the tool affect?
It operates within the Microsoft 365 and Entra ID (formerly Azure AD) ecosystem, affecting services like Outlook, SharePoint, and Teams.
Details
Original description by the author
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
Popularity
- GitHub stars
- 35k
- Ranking position
- #6178
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
Gives your AI agent ready-made instructions for a specific task, so it does it better and faster.
mukul975/Anthropic-Cybersecurity-Skills
abusing-shadow-credentials-for-privesc
Teaches your AI agent to write clear, well-structured text.
mukul975/Anthropic-Cybersecurity-Skills
achieving-cmmc-level-2-compliance
Helps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
mukul975/Anthropic-Cybersecurity-Skills
acquiring-disk-image-with-dd-and-dcfldd
Helps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
mukul975/Anthropic-Cybersecurity-Skills
Similar skills
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC