| ID | Technique | Tactic |
|---|---|---|
| T1053.005 | Scheduled Task | Execution |
| T1105 | Ingress Tool Transfer | Persistence |
Detection: Cisco Secure Endpoint - Downloaded Script in Task Command
Description
This analytic detects a PowerShell download alert followed by a scheduled-task creation command naming the same script, by correlating Cisco Secure Endpoint Behavioral Protection alerts. The shared file path may indicate a staged persistence attempt. Neither alert proves the download completed or the task registered; review task XML, script content, 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 ("20200719101800","20220408163700")
9
10
11| spath path=bp_data.details.matched_activity.events{0}.process:start.parent_guid output=parent_guid
12
13| spath path=bp_data.details.matched_activity.events{0}.process:start.cmd_line output=process_command
14
15
16| rex field=process_command "(?i)(?<staged_file>[A-Za-z]:[^'\"]+?\.ps1)"
17
18
19| eval staged_file=lower(staged_file)
20
21
22| eval stage=case(sig_id="20200719101800","download",
23 sig_id="20220408163700","schedule")
24
25
26| eval event_time=tonumber(timestamp)+tonumber(timestamp_nanoseconds)/1000000000
27
28
29| where isnotnull(endpoint_guid)
30 AND isnotnull(parent_guid)
31 AND isnotnull(staged_file)
32 AND isnotnull(event_time)
33
34
35| sort 0 endpoint_guid parent_guid staged_file event_time
36
37
38| streamstats max(eval(if(stage="download",event_time,null()))) as download_time
39 last(eval(if(stage="download",process_command,null()))) as download_command
40 by endpoint_guid parent_guid staged_file
41
42
43| where stage="schedule"
44 AND isnotnull(download_time)
45 AND event_time>=download_time
46 AND event_time-download_time<=300
47
48
49| eval firstTime=download_time,
50 lastTime=event_time,
51 task_command=process_command
52
53
54| dedup endpoint_guid parent_guid staged_file download_time
55
56
57| eval user=coalesce(user,"unknown")
58
59
60| table dest user endpoint_guid parent_guid staged_file
61 download_command task_command firstTime lastTime
62
63| `security_content_ctime(firstTime)`
64
65| `security_content_ctime(lastTime)`
66
67| `cisco_secure_endpoint___downloaded_script_in_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___downloaded_script_in_task_command_filter | search * |
cisco_secure_endpoint___downloaded_script_in_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 approved deployment workflow may download a script and register a task for it. A failed task creation command can also alert. Review the download URL, script content, task registration, trigger and action, account, and parent process.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Script $staged_file$ downloaded and then scheduled as a task on $dest$ | dest | system | 20 |
Threat Objects
| Field | Type |
|---|---|
| task_command | command |
| staged_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