| ID | Technique | Tactic |
|---|---|---|
| T1047 | Windows Management Instrumentation | Execution |
| T1053.005 | Scheduled Task | Execution |
Detection: Cisco Secure Endpoint - WMI Script and Task Command
Description
This analytic detects a WMI command to start a VBS script followed by a scheduled-task creation command referencing the same script path, by correlating Cisco Secure Endpoint Behavioral Protection alerts on one endpoint. The sequence may indicate a persistence attempt, but neither alert proves that the WMI-launched script ran or that Task Scheduler registered or executed the task. It is an intermediate signal for review alongside other risk. Check command results and any prevention action.
Search
1`cisco_secure_endpoint`
2event_type="Threat Detection"
3
4
5| `cisco_secure_endpoint_extract_bp_fields`
6
7
8| where sig_id IN ("20190409192004","20200501215232")
9
10
11| spath path=bp_data.details.matched_activity.events{0}.process:start.cmd_line output=process_command
12
13
14| rex field=process_command "(?i)cscript(?:\.exe)?\s+//nologo\s+(?<script_file>[A-Za-z]:.+?\.vbs)"
15
16
17| eval script_file=lower(script_file),
18 stage=case(sig_id="20190409192004","wmi",
19 sig_id="20200501215232","task")
20
21
22| eval event_time=tonumber(timestamp)+tonumber(timestamp_nanoseconds)/1000000000
23
24
25| where isnotnull(endpoint_guid)
26 AND isnotnull(script_file)
27 AND isnotnull(event_time)
28
29
30| sort 0 endpoint_guid script_file event_time
31
32
33| streamstats max(eval(if(stage="wmi",event_time,null()))) as wmi_time
34 last(eval(if(stage="wmi",process_command,null()))) as wmi_command
35 by endpoint_guid script_file
36
37
38| where stage="task"
39 AND isnotnull(wmi_time)
40 AND event_time>=wmi_time
41 AND event_time-wmi_time<=300
42
43
44| eval task_command=process_command,
45 firstTime=wmi_time,
46 lastTime=event_time
47
48
49| dedup endpoint_guid script_file wmi_time
50
51
52| eval user=coalesce(user,"unknown")
53
54
55| table dest user endpoint_guid script_file wmi_command
56 task_command bp_response firstTime lastTime
57
58| `security_content_ctime(firstTime)`
59
60| `security_content_ctime(lastTime)`
61
62| `cisco_secure_endpoint___wmi_script_and_task_command_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Cisco Secure Endpoint Behavioral Protection Threat Detection | Other | 'cisco:se' |
'not_applicable' |
Macros Used
| Name | Value |
|---|---|
| cisco_secure_endpoint | sourcetype="cisco:se" |
| search bp_engine=apde | |
| spath path=bp_data.details.sig_id output=sig_id | |
| spath path=computer.connector_guid output=endpoint_guid | |
| spath path=computer.hostname output=dest | |
| spath path=bp_data.details.matched_activity.events{0}.process:start.user.name output=user | |
| spath path=bp_data.details.matched_activity.events{0}.registry:set.user.name output=registry_user | |
| spath path=bp_data.details.matched_activity.events{0}.file:create.user.name output=file_user | |
| eval user=coalesce(user,registry_user,file_user) | |
| spath path=bp_data.audit output=bp_audit | |
| spath path=bp_data.details.actions{}.action output=bp_action | |
| spath path=bp_data.details.actions{}.status output=bp_action_status | |
| eval bp_response=case(bp_audit="true","audit mode",isnotnull(bp_action_status),mvjoin(bp_action,", "),true(),"no action reported")` | |
| cisco_secure_endpoint___wmi_script_and_task_command_filter | search * |
cisco_secure_endpoint___wmi_script_and_task_command_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
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 Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
Implementation
This search requires Cisco Secure Endpoint Behavioral Protection Threat Detection alerts, which include event_type="Threat Detection".
This search uses an input macro named cisco_secure_endpoint.
We strongly recommend that you specify your environment-specific configurations (index, source, sourcetype, etc.) for Cisco Secure Endpoint Behavioral Protection Threat Detection alerts.
Replace the macro definition with configurations for your Splunk environment.
The cisco_secure_endpoint_extract_bp_fields macro extracts the common signature, endpoint, actor, and prevention-response fields used by this search.
The search also uses a post-filter macro designed to filter out known false positives.
The logs are to be ingested using the Cisco Security Cloud App for Splunk (https://splunkbase.splunk.com/app/7404).
In Protect mode, a Behavioral Protection response can kill or quarantine an earlier stage, so this search requires each later alert to have actually appeared. Review bp_data.audit and bp_data.details.actions in the source events before concluding that a task registered, a process completed, or a transfer succeeded. The included audit-mode fixtures verify alert correlation, not survival of an enforced prevention action.
Known False Positives
An administrator may use WMI to run a maintenance VBS and then schedule it. A task creation command can also fail while still producing an alert. Review the VBS contents, WMI return status, task registration, account, and change record.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| WMI script launch and scheduled task creation sharing script $script_file$ on $dest$ | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| wmi_command | command |
| task_command | command |
| script_file | file_path |
References
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | not_applicable |
cisco:se |
| Integration | ✅ Passing | Dataset | not_applicable |
cisco:se |
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: 1