Platform-specific hunting procedures and queries
This guide provides platform-specific hunting procedures for common security operations. Each section includes:
• CrowdStrike Falcon
• Microsoft Defender for Endpoint
• SentinelOne
• Checkpoint Harmony Endpoint
• Carbon Black
• Cortex XDR
• Splunk
• Elastic/ELK Stack
• Microsoft Sentinel
• QRadar (coming soon)
• LogRhythm (coming soon)
• Zeek/Bro
• Wireshark (coming soon)
• Suricata (coming soon)
• Palo Alto (coming soon)
EDR CLOUD
DeviceEvents | where Timestamp > ago(7d) | where FileName =~ "suspicious.exe" | project Timestamp, DeviceName, FolderPath, FileName, SHA256, InitiatingProcessFileName | order by Timestamp desc
DeviceProcessEvents | where Timestamp > ago(24h) | where FileName in~ ("powershell.exe", "cmd.exe", "wscript.exe") | where ProcessCommandLine contains "invoke" | project Timestamp, DeviceName, FileName, ProcessCommandLine, AccountName | order by Timestamp desc
contains
for substring matching, has
for whole word matching.
DeviceNetworkEvents | where Timestamp > ago(7d) | where RemoteIPType == "Public" | where RemotePort in (22, 443, 8080) | summarize ConnectionCount=count() by DeviceName, RemoteIP, RemotePort, InitiatingProcessFileName | where ConnectionCount > 10 | order by ConnectionCount desc
DeviceLogonEvents | where Timestamp > ago(24h) | where ActionType == "LogonFailed" | summarize FailedAttempts=count() by DeviceName, AccountName, LogonType | where FailedAttempts >= 5 | order by FailedAttempts desc
DeviceRegistryEvents | where Timestamp > ago(7d) | where RegistryKey has_any ("Run", "RunOnce", "Startup") | project Timestamp, DeviceName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName | order by Timestamp desc
EDR ON-PREM/CLOUD
File Name: *mimikatz* File Path: C:\Users\*\Downloads\* File Hash: 4a5e9b8c7d6f3a2b1c0d9e8f7a6b5c4d
Event Type: Process Creation AND Process Name: contains "powershell" AND Command Line: contains "bypass" Time Range: Last 7 days
EDR CLOUD
DeviceFileEvents | where Timestamp > ago(7d) | where FileName =~ "suspicious.exe" or SHA256 == "hash_here" | project Timestamp, DeviceName, FolderPath, FileName, SHA256, InitiatingProcessFileName | order by Timestamp desc
DeviceProcessEvents | where Timestamp > ago(24h) | where FileName =~ "powershell.exe" | where ProcessCommandLine has_any ("bypass", "encodedcommand", "invoke-expression") | project Timestamp, DeviceName, ProcessCommandLine, AccountName, InitiatingProcessFileName
DeviceNetworkEvents | where Timestamp > ago(7d) | where RemoteIPType == "Public" | where RemotePort in (22, 3389, 4444, 5555) | extend GeoInfo = geo_info_from_ip_address(RemoteIP) | project Timestamp, DeviceName, RemoteIP, RemotePort, InitiatingProcessFileName, Country=tostring(GeoInfo.country) | order by Timestamp desc
geo_info_from_ip_address()
function to enrich your queries with geographic data automatically.
SIEM ON-PREM/CLOUD
index=windows EventCode=11 | search TargetFilename="*suspicious.exe*" | table _time, Computer, TargetFilename, Image, Hashes | sort - _time
index=windows EventCode=1 | search Image="*powershell.exe" CommandLine="*bypass*" | table _time, Computer, Image, CommandLine, User, ParentImage | sort - _time | head 100
index=windows EventCode=3 | search DestinationPort IN (22, 443, 3389) | stats count by Computer, DestinationIp, DestinationPort, Image | where count > 10 | sort - count
index=windows EventCode=1 | bucket _time span=1h | stats count by _time, Computer, Image | eventstats avg(count) as avg, stdev(count) as stdev by Computer, Image | eval threshold = avg + (2 * stdev) | where count > threshold | table _time, Computer, Image, count, threshold
SIEM OPEN-SOURCE
event.code: 1 AND process.name: "powershell.exe" AND process.command_line: (*bypass* OR *encodedcommand*)
event.code:11 AND file.name:*.exe AND file.path:*\\Temp\\*
process where process.name == "powershell.exe" and (process.command_line like "*bypass*" or process.command_line like "*encodedcommand*")
EDR CLOUD
EventType = "File Creation" AND TgtFileName ContainsCIS "suspicious.exe"
EventType = "Process Creation" AND ( SrcProcName ContainsCIS "powershell.exe" OR SrcProcName ContainsCIS "cmd.exe" ) AND SrcProcCmdLine ContainsCIS "bypass"
ContainsCIS
for case-insensitive contains, Contains
for case-sensitive.
SIEM CLOUD
SecurityEvent | where TimeGenerated > ago(7d) | where EventID == 4688 | where Process has "powershell.exe" | where CommandLine has_any ("bypass", "encodedcommand") | project TimeGenerated, Computer, Account, Process, CommandLine
let suspiciousProcesses = SecurityEvent | where EventID == 4688 | where Process has "powershell.exe" | project TimeGenerated, Computer, Account; let networkConnections = CommonSecurityLog | where DeviceVendor == "Palo Alto Networks" | project TimeGenerated, Computer=SourceIP; suspiciousProcesses | join kind=inner (networkConnections) on Computer | where abs(datetime_diff('minute', suspiciousProcesses.TimeGenerated, networkConnections.TimeGenerated)) < 5
NETWORK OPEN-SOURCE
cat http.log | zeek-cut id.orig_h id.resp_h method host uri | grep -i "suspicious"
cat ssl.log | zeek-cut id.orig_h id.resp_h server_name | grep -v "google.com\|microsoft.com\|amazon.com"
cat dns.log | zeek-cut id.orig_h query | sort | uniq -c | sort -rn | head -20
cat conn.log | jq -r '. | select(.duration > 3600)'