Detection: Windows Scheduled Task with Suspicious Name

Description

The following analytic detects the creation, modification, or enabling of scheduled tasks with known suspicious or malicious task names. It leverages Windows Security EventCode 4698, 4700, and 4702 to identify when such tasks are registered, modified, or enabled. This activity is significant as it may indicate an attempt to establish persistence or execute malicious commands on a system. If confirmed malicious, this could allow an attacker to maintain access, execute arbitrary code, or escalate privileges, posing a severe threat to the environment.

 1`wineventlog_security` EventCode IN (4698,4700,4702)
 2
 3| eval TaskContent = case(isnotnull(TaskContentNew),TaskContentNew,true(),TaskContent)
 4
 5| xmlkv TaskContent
 6
 7| stats count min(_time) as firstTime max(_time) as lastTime latest(Arguments) as Arguments latest(Author) as Author by Computer, TaskName, Command, Enabled, Hidden,Caller_User_Name, EventCode
 8
 9| lookup windows_suspicious_tasks task_name as TaskName 
10
11| where isnotnull(tool_type)
12
13| eval command=TaskName, process=Command+if(isnotnull(Arguments)," ".Arguments,""), src_user=Author, user = Caller_User_Name, dest = Computer
14
15| `security_content_ctime(firstTime)` 
16
17| `security_content_ctime(lastTime)`
18
19| `windows_scheduled_task_with_suspicious_name_filter`

Data Source

Name Platform Sourcetype Source
Windows Event Log Security 4698 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Security'
Windows Event Log Security 4700 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Security'
Windows Event Log Security 4702 Windows icon Windows 'xmlwineventlog' 'XmlWinEventLog:Security'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
windows_scheduled_task_with_suspicious_name_filter search *
windows_scheduled_task_with_suspicious_name_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 Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

To successfully implement this search, you need to be ingesting Windows Security Event Logs with 4698 EventCode enabled. The Windows TA is also required.

Known False Positives

False positives are possible if legitimate applications are allowed to register tasks that call a shell to be spawned. Filter as needed based on command-line or processes that are used legitimately.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

A windows scheduled task was created with known suspicious task name [$TaskName$] on $dest$, this may be a [$tool$] indicator

Risk Object Risk Object Type Risk Score Threat Objects
user user 70 Command
dest system 70 Command

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset XmlWinEventLog:Security XmlWinEventLog
Integration ✅ Passing Dataset XmlWinEventLog:Security XmlWinEventLog

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