Skip to content

Commit 284dfc8

Browse files
authored
Merge pull request #3267 from nterl0k/nterl0k-t1033-query-remote-usage
Nterl0k - T1033 Query.exe usage on remote devices.
2 parents 6133a68 + 25cd13f commit 284dfc8

File tree

2 files changed

+68
-5
lines changed

2 files changed

+68
-5
lines changed

detections/endpoint/system_user_discovery_with_query.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: System User Discovery With Query
22
id: ad03bfcf-8a91-4bc2-a500-112993deba87
3-
version: 4
4-
date: '2024-11-13'
3+
version: 5
4+
date: '2025-02-05'
55
author: Mauricio Velazco, Splunk
66
status: production
77
type: Hunting
@@ -17,9 +17,8 @@ data_source:
1717
- Windows Event Log Security 4688
1818
- CrowdStrike ProcessRollup2
1919
search: '| tstats `security_content_summariesonly` count min(_time) as firstTime max(_time)
20-
as lastTime from datamodel=Endpoint.Processes where (Processes.process_name="query.exe")
21-
(Processes.process=*user*) by Processes.dest Processes.user Processes.parent_process
22-
Processes.process_name Processes.process Processes.process_id Processes.parent_process_id
20+
as lastTime from datamodel=Endpoint.Processes where (Processes.process_name="query.exe" OR Processes.original_file_name="query.exe")
21+
AND Processes.process="*user*" AND ((NOT Processes.process="*/server*") OR Processes.process IN ("*/server:localhost*", "*/server:127.0.0.1*")) by Processes.dest Processes.user Processes.parent_process Processes.process_name Processes.process Processes.process_id Processes.parent_process_id
2322
| `drop_dm_object_name(Processes)` | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`
2423
| `system_user_discovery_with_query_filter`'
2524
how_to_implement: The detection is based on data that originates from Endpoint Detection
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Windows System Remote Discovery With Query
2+
id: 94859172-a521-474f-97ac-4cf4b09634a3
3+
version: 1
4+
date: '2025-02-05'
5+
author: Steven Dick
6+
status: production
7+
type: Anomaly
8+
description: The following analytic detects the execution of `query.exe` with command-line arguments aimed at discovering data on remote devices. It leverages data from Endpoint Detection and Response (EDR) agents, focusing on process names and command-line executions. This activity is significant as adversaries may use `query.exe` to gain situational awareness and perform Active Directory discovery on compromised endpoints. If confirmed malicious, this behavior could allow attackers to identify various details about a system, aiding in further lateral movement and privilege escalation within the network.
9+
data_source:
10+
- Sysmon Event ID 1
11+
- Windows Security Event ID 4688
12+
- CrowdStrike ProcessRollup2
13+
search: |-
14+
| tstats `security_content_summariesonly` values(Processes.process_current_directory) as Processes.process_current_directory values(Processes.process_id) as Processes.process_id values(Processes.process) as Processes.process values(Processes.parent_process_id) as Processes.parent_process_id values(Processes.parent_process) as Processes.parent_process count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where (Processes.process_name="query.exe" OR Processes.original_file_name="query.exe") AND (Processes.process="*/server*") AND NOT Processes.process IN ("*/server:localhost*", "*/server:127.0.0.1*") by Processes.dest Processes.user Processes.process_name Processes.parent_process_name
15+
| `drop_dm_object_name(Processes)`
16+
| `security_content_ctime(firstTime)`
17+
| `security_content_ctime(lastTime)`
18+
| `windows_system_remote_discovery_with_query_filter`
19+
how_to_implement: 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.
20+
known_false_positives: Administrators or power users may use this command for troubleshooting.
21+
references:
22+
- https://attack.mitre.org/techniques/T1033/
23+
drilldown_searches:
24+
- name: View the detection results for - "$dest$" and "$user$"
25+
search: '%original_detection_search% | search dest = "$dest$" user = "$user$"'
26+
earliest_offset: $info_min_time$
27+
latest_offset: $info_max_time$
28+
- name: View risk events for the last 7 days for - "$dest$" and "$user$"
29+
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$","$user$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
30+
earliest_offset: $info_min_time$
31+
latest_offset: $info_max_time$
32+
- name: Investigate processes on $dest$
33+
search: '| from datamodel:Endpoint.Processes | search dest=$dest$ process_name = $process_name|s$'
34+
earliest_offset: $info_min_time$
35+
latest_offset: $info_max_time$
36+
rba:
37+
message: The user $user$ ran the Query command to enumerate the remote system $dest$
38+
risk_objects:
39+
- field: user
40+
type: user
41+
score: 25
42+
- field: dest
43+
type: system
44+
score: 25
45+
threat_objects:
46+
- field: process_name
47+
type: process_name
48+
tags:
49+
analytic_story:
50+
- Active Directory Discovery
51+
asset_type: Endpoint
52+
mitre_attack_id:
53+
- T1033
54+
product:
55+
- Splunk Enterprise
56+
- Splunk Enterprise Security
57+
- Splunk Cloud
58+
security_domain: endpoint
59+
tests:
60+
- name: True Positive Test
61+
attack_data:
62+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1033/query_remote_usage/query_remote_usage.log
63+
source: XmlWinEventLog:Microsoft-Windows-Sysmon/Operational
64+
sourcetype: XmlWinEventLog

0 commit comments

Comments
 (0)