본문으로 건너뛰기
cccskills
무료GitHub에 공개

detecting-entra-offensive-tools-in-graph-logs

Investigate Entra ID reconnaissance by searching Graph API logs for tool signatures and unusual directory queries. Use KQL, a log query language, to correlate suspicious requests with sign-ins and turn useful searches into Sentinel detection rules.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Hunt AADGraphActivityLogs and MicrosoftGraphActivityLogs in Microsoft Sentinel/Log Analytics using KQL to fingerprint offensive Entra ID enumeration tools such as ROADtools, AADInternals, and AzureHound, including User-Agent signatures, roadrecon endpoint sweeps, and sign-in correlation. Use when investigating suspicious Microsoft Graph API activity, Entra ID reconnaissance, or building Sentinel analytics rules to detect these tools.

연동 도구Azure

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Investigating Graph API activity after suspected credential theft
  • Checking whether offensive tool activity is visible in logs
  • Creating and tuning scheduled Sentinel detection rules
  • Linking suspicious API requests to sign-in sessions

포함된 파일(5)

  • SKILL.md10.9 KB
  • LICENSE11.0 KB
  • references/api-reference.md2.5 KB
  • references/standards.md1.3 KB
  • scripts/agent.py5.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Detecting Entra Offensive Tools in Graph Logs

Overview

For nearly a decade the legacy Azure AD Graph API (graph.windows.net) was a defender blind spot: requests to it produced no first-class activity log, so tools like ROADtools (roadrecon) and AADInternals — which lean heavily on AAD Graph — could enumerate an entire tenant with little trace. That changed when Microsoft shipped AADGraphActivityLogs (general availability in 2026), the counterpart to the already-available MicrosoftGraphActivityLogs (graph.microsoft.com). Together these two tables give SOCs request-level visibility into directory API traffic: the caller identity, app, source IP, HTTP method, request URI, and crucially the User-Agent.

This skill is the defensive complement to offensive Entra tooling. It hunts the two Graph activity tables for the behavioral and string fingerprints those tools leave behind. Many operators forget to spoof the User-Agent, so ROADtools (built on Python's aiohttp) emits a User-Agent like Python/3.12 aiohttp/3.10.4, and AADInternals frequently leaves AADInternals or library strings in the agent. Even when the agent is spoofed, the tools betray themselves through a characteristic endpoint-sweep pattern: roadrecon gather pulls users, groups, applications, serviceprincipals, devices, directoryroles, roledefinitions, oauth2permissiongrants, and more within a tight time window — a signature that survives header spoofing.

The activity being detected maps to MITRE ATT&CK T1078.004 – Valid Accounts: Cloud Accounts: an adversary using legitimate (often phished or token-stolen) cloud credentials to enumerate and operate against the tenant via the Graph APIs. These detections both surface live intrusions and validate that the offensive techniques in the companion red-team skills are observable.

When to Use

  • Building or tuning detections for Microsoft Sentinel / Log Analytics covering Entra ID
  • Threat hunting after suspected credential theft, device-code phishing, or OAuth consent abuse
  • Purple-team exercises validating that ROADtools/AADInternals/AzureHound activity is detectable
  • Investigating an alert and needing to correlate Graph API calls back to a sign-in/session
  • Closing the legacy Azure AD Graph visibility gap after enabling AADGraphActivityLogs

Prerequisites

  • A Microsoft Sentinel workspace (or Log Analytics) ingesting:
    • MicrosoftGraphActivityLogs (diagnostic setting on Microsoft Entra ID -> graph.microsoft.com)
    • AADGraphActivityLogs (diagnostic setting on Microsoft Entra ID -> legacy Azure AD Graph)
  • SigninLogs and AADNonInteractiveUserSignInLogs for correlation
  • Microsoft Sentinel Reader/Responder (or Log Analytics Reader) RBAC to run KQL
  • Familiarity with Kusto Query Language (KQL)
  • Enable the diagnostic settings (Azure Portal -> Microsoft Entra ID -> Diagnostic settings -> send MicrosoftGraphActivityLogs and AADGraphActivityLogs to your workspace), or via CLI:
    az monitor diagnostic-settings create \
      --name "entra-graph-logs" \
      --resource "/providers/microsoft.aadiam/diagnosticSettings" \
      --logs '[{"category":"MicrosoftGraphActivityLogs","enabled":true},{"category":"AADGraphActivityLogs","enabled":true}]' \
      --workspace "<log-analytics-workspace-id>"
    

Objectives

  • Confirm both Graph activity tables are flowing into the workspace
  • Detect User-Agent string fingerprints of ROADtools, AADInternals, and AzureHound
  • Detect the endpoint-sweep behavioral fingerprint that survives User-Agent spoofing
  • Correlate suspicious Graph activity back to a sign-in/session and source identity
  • Operationalize the best queries as scheduled analytics rules

MITRE ATT&CK Mapping

IDTechniqueApplication in this skill
T1078.004Valid Accounts: Cloud AccountsDetecting adversaries using valid cloud credentials/tokens to enumerate the tenant via the Microsoft Graph and legacy Azure AD Graph APIs

Related techniques surfaced by these hunts: T1087.004 Account Discovery: Cloud Account, T1069.003 Permission Groups Discovery: Cloud Groups, T1526 Cloud Service Discovery.

Workflow

Step 1: Confirm both tables are ingesting

Before hunting, verify the data exists and inspect the schema fields you will pivot on.

union withsource=Tbl MicrosoftGraphActivityLogs, AADGraphActivityLogs
| where TimeGenerated > ago(1d)
| summarize Records=count(), LastSeen=max(TimeGenerated) by Tbl

Step 2: Hunt User-Agent fingerprints (ROADtools / aiohttp)

ROADtools uses aiohttp; an un-spoofed run shows python + aiohttp in the User-Agent.

AADGraphActivityLogs
| where TimeGenerated > ago(7d)
| where RequestMethod == "GET"
| where UserAgent contains "python" and UserAgent contains "aiohttp"
| summarize RequestCount = count() by CallerIpAddress, AppId, UserAgent, UserId
| sort by RequestCount desc

Step 3: Hunt AADInternals and AzureHound agents

AADInternals leaves toolkit/library strings; AzureHound's Go HTTP client and BloodHound tooling have distinctive agents.

union MicrosoftGraphActivityLogs, AADGraphActivityLogs
| where TimeGenerated > ago(7d)
| where UserAgent has_any ("AADInternals", "aad-internals", "azurehound",
                           "BloodHound", "python-requests", "Go-http-client")
| project TimeGenerated, UserAgent, CallerIpAddress, AppId, UserId, RequestUri
| sort by TimeGenerated desc

Step 4: Behavioral hunt — the roadrecon endpoint sweep (spoof-resistant)

Even with a spoofed agent, roadrecon gather touches a recognizable set of directory resources in a short window. Bucket by user and 5 minutes; alert when one identity hits the full sweep.

AADGraphActivityLogs
| where TimeGenerated > ago(1d)
| where RequestMethod == "GET"
| extend TopLevelResource = tolower(tostring(split(split(RequestUri, "?")[0], "/")[3]))
| summarize
    TopLevelResources = make_set(TopLevelResource),
    AppIds = make_set(AppId),
    CallerIPs = make_set(CallerIpAddress),
    UserAgents = make_set(UserAgent),
    StartTime = min(TimeGenerated),
    EndTime = max(TimeGenerated)
    by UserId, bin(TimeGenerated, 5m)
| where TopLevelResources has_all ("users", "tenantdetails", "groups", "applications",
    "serviceprincipals", "devices", "directoryroles", "roledefinitions", "contacts",
    "oauth2permissiongrants", "authorizationpolicy")
| project StartTime, EndTime, UserId, AppIds, CallerIPs, UserAgents

Step 5: High-volume enumeration outliers

Catch tooling that simply makes far more directory reads than a human in a short window.

MicrosoftGraphActivityLogs
| where TimeGenerated > ago(1d)
| where RequestMethod == "GET"
| where RequestUri has_any ("/users", "/groups", "/servicePrincipals", "/applications",
                            "/directoryRoles", "/roleManagement")
| summarize Reads=count(), Resources=dcount(RequestUri) by UserId, AppId, CallerIpAddress, bin(TimeGenerated, 10m)
| where Reads > 200
| sort by Reads desc

Step 6: Correlate Graph activity to the originating sign-in

Pivot a suspicious Graph caller back to the sign-in to recover device, location, MFA, and conditional-access result. Note the SignInActivityId in AADGraphActivityLogs may carry == padding versus SigninLogs.UniqueTokenIdentifier.

AADGraphActivityLogs
| where TimeGenerated > ago(1d)
| where UserAgent contains "aiohttp"
| extend TokenId = trim_end("=", tostring(SignInActivityId))
| join kind=leftouter (
    SigninLogs
    | extend TokenId = tostring(UniqueTokenIdentifier)
    | project TokenId, UserPrincipalName, IPAddress, AppDisplayName, ConditionalAccessStatus, DeviceDetail
) on TokenId
| project TimeGenerated, UserId, UserPrincipalName, CallerIpAddress, IPAddress,
          AppDisplayName, ConditionalAccessStatus, UserAgent

Step 7: Operationalize as analytics rules

Promote the highest-fidelity queries (Steps 2-4) to scheduled analytics rules. Set a query period/frequency (e.g., run every 1h over 1d), map the rule to T1078.004, and configure entity mappings (Account = UserId, IP = CallerIpAddress, Host/App = AppId) so incidents enrich automatically. Tune out known automation/service-principal App IDs and approved scanner IPs via a watchlist before enabling.

Tools and Resources

ResourcePurposeSource
AADGraphActivityLogs referenceSchema and field meaninghttps://learn.microsoft.com/entra/identity/monitoring-health/concept-aad-graph-activity-logs
MicrosoftGraphActivityLogsGraph API activity schemahttps://learn.microsoft.com/graph/microsoft-graph-activity-logs-overview
Invictus-IR writeupAADGraphActivityLogs hunting querieshttps://www.invictus-ir.com/news/the-missing-link-aadgraphactivitylogs-finally-arrives
Cloudbrothers analysisBehavioral fingerprinting of ROADtoolshttps://cloudbrothers.info/en/aadgraphactivitylogs/
ROADtoolsThe offensive tool being detectedhttps://github.com/dirkjanm/ROADtools
MITRE T1078.004Valid Accounts: Cloud Accountshttps://attack.mitre.org/techniques/T1078/004/

Detection Fingerprint Reference

ToolPrimary fingerprintTable
ROADtools (roadrecon)python + aiohttp UA; full directory endpoint sweep in 5 minAADGraphActivityLogs
AADInternalsAADInternals / toolkit strings in UA; AAD Graph readsAADGraphActivityLogs
AzureHoundGo HTTP client UA; broad MS Graph enumerationMicrosoftGraphActivityLogs
Generic reconHigh GET volume across users/groups/apps/SPs in short windowboth

Validation Criteria

  • Both MicrosoftGraphActivityLogs and AADGraphActivityLogs confirmed ingesting
  • User-Agent fingerprint hunt for ROADtools/aiohttp executed
  • AADInternals/AzureHound agent hunt executed
  • Behavioral endpoint-sweep hunt executed and tuned for false positives
  • High-volume enumeration outlier query executed
  • At least one finding correlated back to a sign-in/session and source identity
  • Best queries promoted to scheduled analytics rules with T1078.004 mapping and entity mappings
  • Known-good service principals/IPs excluded via watchlist to control false positives

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Assess exposure of Windows secrets protected by DPAPI, the operating system’s data protection service, during authorized security tests. Guide examination and decryption of saved credentials and browser data using available user sessions, credentials, or backup keys.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Assessing saved credential exposure in authorized tests
  • Examining collected DPAPI files offline
  • Reviewing protected browser and RDP credentials
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

Assess Shadow Credentials account takeover during authorized Active Directory testing. Examine permissions that allow public key registration, validate authentication without a password reset, and document credential cleanup, detection opportunities, and access control changes needed for remediation.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Assessing risky permissions identified in BloodHound
  • Validating account takeover without resetting a password
  • Generating directory change records during security exercises
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

Prepare for CMMC Level 2, a cybersecurity certification for defense contractors. Define the systems handling controlled information, review security requirements, calculate the SPRS assessment score, and organize remediation plans and evidence into a readiness report.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Define the assessment scope for systems handling controlled information
  • Calculate an SPRS score and prioritize unmet security requirements
  • Prepare security plans, remediation milestones, and assessment evidence
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

Create disk images for investigations using dd or dcfldd on Linux. The workflow covers write protection, bit-for-bit copying, hash checks to verify integrity, and documentation of the acquisition process.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Preserving a suspect drive before investigation
  • Creating evidence copies of USB devices or memory cards
  • Verifying that a disk image matches its source
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

Review Active Directory permissions with ldap3, a Python library for directory queries. Identify excessive access granted to non-administrative accounts, explain potential privilege escalation paths, and produce a JSON report with affected objects and remediation recommendations.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Auditing excessive Active Directory permissions
  • Investigating privilege escalation paths from ordinary accounts
  • Reporting affected objects and permission remediation recommendations
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

Inspect suspicious Android APK files without running them. Analyze permissions, app components, suspicious code patterns, and network indicators, then produce a JSON risk report to support malware triage and detection rule development.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Triage suspicious APK files without running them
  • Inspect dangerous permission combinations and suspicious API calls
  • Extract network indicators for malware detection rules
mukul975/Anthropic-Cybersecurity-Skills3.5만2026년 8월 31일 업데이트

mukul975의 스킬 모두 보기

이 스킬의 문제 신고