Detection: Windows EventLog Recon Activity Using Log Query Utilities

Description

This analytic detects EventLog reconnaissance activity using utilities such as wevtutil.exe, wmic.exe, PowerShell cmdlets like Get-WinEvent, or WMI queries targeting Win32_NTLogEvent. It leverages data from Endpoint Detection and Response (EDR) agents, focusing on process names and command-line arguments. These tools are often used by adversaries to extract usernames, IP addresses, session data, and event information for credential access or situational awareness during lateral movement. While these utilities are legitimate, execution with specific arguments or targeting sensitive logs like Security, PowerShell, or specific EventIDs (e.g., 4624, 4778) can indicate malicious intent. If confirmed malicious, this behavior could allow an attacker to extract sensitive info and potentially have leveraged access or move laterally.

 1
 2| tstats `security_content_summariesonly` values(Processes.process) as process
 3  min(_time) as firstTime max(_time) as lastTime 
 4  from datamodel=Endpoint.Processes 
 5  where (
 6    (Processes.process_name IN ("powershell.exe", "pwsh.exe", "powershell_ise.exe") AND Processes.process IN ("*Get-WinEvent*", "*Get-EventLog*", "*EventLogQuery*", "*.ReadEvent(*"))
 7    OR
 8    (Processes.process_name=wevtutil.exe Processes.process IN ("* qe *", "* query-events *"))
 9    OR
10    (Processes.process_name=wmic.exe Processes.process IN ("*ntevent*"))
11    OR
12    (Processes.process="*Win32_NTLogEvent*" AND Processes.process="*EventCode*")
13    OR
14    (Processes.process IN ("*PsLogList*", "*Eventquery*"))
15  ) 
16  by 
17    Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec
18    Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name
19    Processes.parent_process_path Processes.process Processes.process_exec Processes.process_guid
20    Processes.process_hash Processes.process_id Processes.process_integrity_level Processes.process_name
21    Processes.process_path Processes.user Processes.user_id Processes.vendor_product
22
23| `drop_dm_object_name(Processes)`
24
25| `security_content_ctime(firstTime)` 
26
27| `security_content_ctime(lastTime)` 
28
29| `windows_eventlog_recon_activity_using_log_query_utilities_filter`

Data Source

Name Platform Sourcetype Source
CrowdStrike ProcessRollup2 N/A 'crowdstrike:events:sensor' 'crowdstrike'
Sysmon EventID 1 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Microsoft-Windows-Sysmon/Operational'
Windows Event Log Security 4688 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_eventlog_recon_activity_using_log_query_utilities_filter search *
windows_eventlog_recon_activity_using_log_query_utilities_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1654 Log Enumeration Discovery
Exploitation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

The detection is based on data that originates from Endpoint Detection and Response (EDR) agents. These agents are designed to provide security-related telemetry from the endpoints where the agent is installed. To implement this search, you must ingest logs that contain the process GUID, process name, and parent process. Additionally, you must ingest complete command-line executions. These logs must be processed using the appropriate Splunk Technology Add-ons that are specific to the EDR product. The logs must also be mapped to the Processes node of the Endpoint data model. Use the Splunk Common Information Model (CIM) to normalize the field names and speed up the data modeling process.

Known False Positives

System administrators or monitoring tools may legitimately use these utilities to gather logs for troubleshooting or auditing. Filter known admin behavior or monitoring solutions as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

Suspicious log query $process$ command was run on $dest$ by $user$

Risk Object Risk Object Type Risk Score Threat Objects
user user 30 No Threat Objects
dest system 30 No Threat Objects

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Microsoft-Windows-Sysmon/Operational XmlWinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 2