Query Details
// Analyzing Malicious Microsoft Graph API Rate Limit Count // https://www.linkedin.com/posts/activity-7218488532250546178-zAMf/ // Utilizing Sentinel’s BehaviourAnalytics with MicrosoftGraphActivityLogs to pinpoint Entra app IDs that are abusing the Microsoft Graph API and causing throttling due to malicious activities. Once the throttling operation resource is identified, additional KQLs can be further deployed to detect specific use case misuse. 🎯 let AttackerIPs = BehaviorAnalytics | where TimeGenerated > ago(90d) | extend ThreatIntelIndicatorDescription = tostring(DevicesInsights.ThreatIntelIndicatorDescription) | where ThreatIntelIndicatorDescription contains "proxy" | distinct SourceIPAddress; MicrosoftGraphActivityLogs | where TimeGenerated > ago(90d) | where IPAddress has_any(AttackerIPs) | extend path = replace_string(replace_string(replace_regex(tostring(parse_url(RequestUri).Path), @'(\/)+','//'),'v1.0/',''),'beta/','') | extend UriSegments = extract_all(@'\/([A-z2]+|\$batch)($|\/|\(|\$)',dynamic([1]),tolower(path)) | extend OperationResource = strcat_array(UriSegments,'/')| summarize RateLimitedCount=count() by AppId, OperationResource, RequestMethod | sort by RateLimitedCount desc
This KQL query is designed to identify and analyze malicious activities involving the Microsoft Graph API that result in rate limiting (throttling). Here's a simplified breakdown of what the query does:
Identify Attacker IPs:
BehaviorAnalytics table for the past 90 days to find IP addresses associated with threat intelligence indicators that mention "proxy".Analyze Microsoft Graph API Logs:
MicrosoftGraphActivityLogs table, also for the past 90 days, to find activities from the identified attacker IPs.RequestUri to extract and clean up the path information.Summarize Throttling Events:
AppId) and operation resource combination has been rate-limited (throttled).In essence, this query helps pinpoint which Entra app IDs are abusing the Microsoft Graph API, leading to throttling, and provides a basis for further investigation into specific misuse cases.

Steven Lim
Released: August 2, 2024
Tables
Keywords
Operators