Query Details
// Sentinel All-In-One IP ThreatHunt // https://www.linkedin.com/pulse/microsoft-sentinel-kql-solo-leveling-steven-lim-8hsqc/ // This KQL query searches across these Sentinel log tables for the ip variable that is defined at the start: // Anomalies, CloudAppEvents, CommonSecurityLog, DeviceEvents, DeviceFileEvents, DeviceInfo, DeviceLogonEvents, AzureActivity DeviceNetworkEvents, EmailEvents, OfficeActivity, SecurityEvent, ThreatIntelligenceIndicator, UrlClickEvents, BehaviorAnalytics let ip = "127.0.0.1"; search in (Anomalies,CloudAppEvents,CommonSecurityLog,DeviceEvents,DeviceFileEvents,DeviceInfo,DeviceLogonEvents,AzureActivity, DeviceNetworkEvents,EmailEvents,OfficeActivity,SecurityEvent,ThreatIntelligenceIndicator,UrlClickEvents,BehaviorAnalytics) TimeGenerated between (ago(1d) .. now()) and ( // ** Events initiated by this IP ** DestinationIpAddress == ip // Anomalies, UrlClickEvents or IPAddress == ip // CloudAppEvents or RemoteIP == ip // CommonSecurityLog, DeviceEvents, DeviceLogonEvents, DeviceNetworkEvents or FileOriginIP == ip // DeviceFileEvents or SenderIPv4 == ip // EmailEvents or ClientIP == ip // OfficeActivity or NetworkDestinationIP == ip // ThreatIntelligenceIndicator or DestinationIPAddress == ip // BehaviorAnalytics // // ** Events affecting this IP ** or SourceIpAddress == ip // Anomalies or SourceIP == ip // CommonSecurityLog, DeviceEvents or CallerIpAddress == ip // AzureActivity or RequestSourceIP == ip // DeviceFileEvents or PublicIP == ip // DeviceInfo or LocalIP == ip // DeviceNetworkEvents or ClientIPAddress == ip // SecurityEvent or NetworkSourceIP == ip // ThreatIntelligenceIndicator or SourceIPAddress == ip // BehaviorAnalytics )
This KQL query is designed to search for a specific IP address ("127.0.0.1") across multiple log tables in Microsoft Sentinel. It looks for events that either originate from or are directed towards this IP address within the last 24 hours. The query checks various fields in each log table to find any matches with the specified IP address. Here’s a simplified breakdown:
DestinationIpAddress, IPAddress, RemoteIP, etc.SourceIpAddress, SourceIP, CallerIpAddress, etc.In essence, this query helps identify any activity related to the specified IP address across a wide range of log data in Microsoft Sentinel.

Steven Lim
Released: August 2, 2024
Tables
Keywords
Operators