From 0772e6352b489294f1d22a6ca2c627a457efddbd Mon Sep 17 00:00:00 2001 From: mhaag-spl <5632822+MHaggis@users.noreply.github.com> Date: Thu, 21 Oct 2021 09:56:27 -0600 Subject: [PATCH] taskscheduler hunting --- ...ws_task_scheduler_event_action_started.yml | 56 +++++++++++++++++++ macros/wineventlog_task_scheduler.yml | 4 ++ ...sk_scheduler_event_action_started.test.yml | 12 ++++ 3 files changed, 72 insertions(+) create mode 100644 detections/endpoint/winevent_windows_task_scheduler_event_action_started.yml create mode 100644 macros/wineventlog_task_scheduler.yml create mode 100644 tests/endpoint/winevent_windows_task_scheduler_event_action_started.test.yml diff --git a/detections/endpoint/winevent_windows_task_scheduler_event_action_started.yml b/detections/endpoint/winevent_windows_task_scheduler_event_action_started.yml new file mode 100644 index 0000000000..c2ddf9368d --- /dev/null +++ b/detections/endpoint/winevent_windows_task_scheduler_event_action_started.yml @@ -0,0 +1,56 @@ +name: WinEvent Windows Task Scheduler Event Action Started +id: b3632472-310b-11ec-9aab-acde48001122 +version: 1 +date: '2021-10-19' +author: Michael Haag, Splunk +type: Hunting +datamodel: +- Endpoint +description: 'The following hunting analytic assists with identifying suspicious tasks that have been registered and ran in Windows using EventID 200 (action run) and 201 (action completed). + It is recommended to filter based on ActionName by specifying specific paths not used in your environment. After some basic tuning, this may be effective in capturing evasive ways to register tasks on Windows. + Review parallel events related to tasks being scheduled. EventID 106 will generate when a new task is generated, however, that does not mean it ran. Capture any files on disk and analyze.' +search: '`wineventlog_task_scheduler` EventID IN ("200","201") + | rename Computer as dest + | stats count min(_time) as firstTime max(_time) as lastTime by TaskName ActionName EventID dest ProcessID + | `security_content_ctime(firstTime)` + | `security_content_ctime(lastTime)` + | `winevent_windows_task_scheduler_event_action_started_filter`' +how_to_implement: Task Scheduler logs are required to be collected. Enable logging with inputs.conf by adding a stanza for [WinEventLog://Microsoft-Windows-TaskScheduler/Operational] and renderXml=true. +known_false_positives: False positives will be present. Filter based on ActionName paths or specify keywords of interest. +references: + - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1053.005/T1053.005.md + - https://thedfirreport.com/2021/10/18/icedid-to-xinglocker-ransomware-in-24-hours/ +tags: + analytic_story: + - IcedID + - Windows Persistence Techniques + dataset: [] + kill_chain_phases: + - Exploitation + mitre_attack_id: + - T1053.005 + product: + - Splunk Enterprise + - Splunk Enterprise Security + - Splunk Cloud + required_fields: + - _time + - TaskName + - ActionName + - EventID + - dest + - ProcessID + security_domain: endpoint + impact: 80 + confidence: 100 + # (impact * confidence)/100 + risk_score: 80 + context: + - Source:Endpoint + - Stage:Defense Evasion + message: A Scheduled Task was scheduled and ran on $dest$. + observable: + - name: dest + type: Hostname + role: + - Victim \ No newline at end of file diff --git a/macros/wineventlog_task_scheduler.yml b/macros/wineventlog_task_scheduler.yml new file mode 100644 index 0000000000..43aad75b53 --- /dev/null +++ b/macros/wineventlog_task_scheduler.yml @@ -0,0 +1,4 @@ +definition: sourcetype="xmlwineventlog" source="WinEventLog:Microsoft-Windows-TaskScheduler/Operational" +description: customer specific splunk configurations(eg- index, source, sourcetype). + Replace the macro definition with configurations for your Splunk Environmnent. +name: wineventlog_task_scheduler diff --git a/tests/endpoint/winevent_windows_task_scheduler_event_action_started.test.yml b/tests/endpoint/winevent_windows_task_scheduler_event_action_started.test.yml new file mode 100644 index 0000000000..eb50729acd --- /dev/null +++ b/tests/endpoint/winevent_windows_task_scheduler_event_action_started.test.yml @@ -0,0 +1,12 @@ +name: WinEvent Windows Task Scheduler Event Action Started Unit Test +tests: +- name: WinEvent Windows Task Scheduler Event Action Started + file: endpoint/winevent_windows_task_scheduler_event_action_started.yml + pass_condition: '| stats count | where count > 0' + earliest_time: '-24h' + latest_time: 'now' + attack_data: + - file_name: windows-taskschedule.log + data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1053.005/windows_taskschedule/windows-taskschedule.log + source: xmlwineventlog + sourcetype: WinEventLog:Microsoft-Windows-TaskScheduler/Operational \ No newline at end of file