| ID | Technique | Tactic |
|---|---|---|
| T1053.005 | Scheduled Task | Execution |
| T1218.005 | Mshta | Persistence |
Detection: Cisco Secure Endpoint - Scheduled Remote MSHTA Payload Executed
Description
This analytic detects a scheduled-task creation command referencing a remote MSHTA URL and a later MSHTA launch naming that same URL on one endpoint, by correlating Cisco Secure Endpoint Behavioral Protection alerts. The shared URL links a persistence attempt to observed execution. The alerts do not prove that Task Scheduler launched MSHTA or that the task registered; check task identity, process lineage, and prevention actions.
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 ("20220810202512","20210616150648")
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)(?<remote_url>https?://[A-Za-z0-9._~:/?#@!$&()*+,;=%-]+)"
15
16
17| eval stage=if(sig_id="20220810202512","task","execution"),
18 remote_url=lower(remote_url),
19 event_time=tonumber(timestamp)+tonumber(timestamp_nanoseconds)/1000000000
20
21
22| where isnotnull(endpoint_guid)
23 AND isnotnull(remote_url)
24 AND isnotnull(event_time)
25
26
27| sort 0 endpoint_guid remote_url event_time
28
29| streamstats last(eval(if(stage="task",event_time,null()))) as task_time
30 last(eval(if(stage="task",process_command,null()))) as task_command
31 by endpoint_guid remote_url
32
33| where stage="execution" AND isnotnull(task_time)
34 AND event_time>=task_time AND event_time-task_time<=300
35
36| eval execution_command=process_command, firstTime=task_time,
37 lastTime=event_time, user=coalesce(user,"unknown")
38
39| dedup endpoint_guid remote_url task_time
40
41
42| table dest user endpoint_guid remote_url task_command execution_command
43 firstTime lastTime
44
45| `security_content_ctime(firstTime)`
46
47| `security_content_ctime(lastTime)`
48
49| `cisco_secure_endpoint___scheduled_remote_mshta_payload_executed_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___scheduled_remote_mshta_payload_executed_filter | search * |
cisco_secure_endpoint___scheduled_remote_mshta_payload_executed_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) | Yes |
| Rule Title | %name% |
| Rule Description | %description% |
| Notable Event Fields | user, dest |
| Creates Intermediate Finding (Risk Event) | No |
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
Approved administration may schedule remote content hosted by an internal service. Verify the URL, content, task owner, and change record. The alerts establish task creation and mshta process start; they do not alone prove that the remote script completed.
Associated Analytic Story
Finding
| Title | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Scheduled task and MSHTA launch sharing remote URL $remote_url$ on $dest$ | dest | system | 50 |
Threat Objects
| Field | Type |
|---|---|
| execution_command | command |
| task_command | command |
| remote_url | url |
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