Detection rules › Splunk

Short Lived Scheduled Task

Status
production
Severity
medium
Group by
task_name
Author
Mauricio Velazco, Splunk
Source
github.com/splunk/security_content

The following analytic detects the creation and deletion of scheduled tasks within a short time frame (less than 30 seconds) using Windows Security EventCodes 4698 and 4699. This behavior is identified by analyzing Windows Security Event Logs and leveraging the Windows TA for parsing. Such activity is significant as it may indicate lateral movement or remote code execution attempts by adversaries. If confirmed malicious, this could lead to unauthorized access, data exfiltration, or execution of malicious payloads, necessitating prompt investigation and response by security analysts.

MITRE ATT&CK coverage

Event coverage

Rule body splunk

name: Short Lived Scheduled Task
id: 6fa31414-546e-11ec-adfa-acde48001122
version: 11
creation_date: '2021-12-03'
modification_date: '2026-05-13'
author: Mauricio Velazco, Splunk
status: production
type: TTP
description: The following analytic detects the creation and deletion of scheduled tasks within a short time frame (less than 30 seconds) using Windows Security EventCodes 4698 and 4699. This behavior is identified by analyzing Windows Security Event Logs and leveraging the Windows TA for parsing. Such activity is significant as it may indicate lateral movement or remote code execution attempts by adversaries. If confirmed malicious, this could lead to unauthorized access, data exfiltration, or execution of malicious payloads, necessitating prompt investigation and response by security analysts.
data_source:
    - Windows Event Log Security 4698
    - Windows Event Log Security 4699
search: |-
    `wineventlog_security` EventCode=4698 OR EventCode=4699
      | xmlkv Message
      | transaction Task_Name  startswith=(EventCode=4698) endswith=(EventCode=4699)
      | eval short_lived=case((duration<30),"TRUE")
      | search  short_lived = TRUE
      | rename ComputerName as dest
      | table _time, dest, Account_Name, Command, Task_Name, short_lived
      | `short_lived_scheduled_task_filter`
how_to_implement: 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: Although uncommon, legitimate applications may create and delete a Scheduled Task within 30 seconds. Filter as needed.
references:
    - https://attack.mitre.org/techniques/T1053/005/
    - https://docs.microsoft.com/en-us/windows/win32/taskschd/about-the-task-scheduler
drilldown_searches:
    - name: View the detection results for - "$dest$"
      search: '%original_detection_search% | search  dest = "$dest$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$dest$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
finding:
    title: A windows scheduled task was created and deleted in 30 seconds on $dest$
    entity:
        field: dest
        type: system
        score: 50
analytic_story:
    - Active Directory Lateral Movement
    - CISA AA22-257A
    - CISA AA23-347A
    - Compromised Windows Host
    - Scheduled Tasks
asset_type: Endpoint
mitre_attack_id:
    - T1053.005
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1053.005/lateral_movement/windows-security.log
          source: WinEventLog:Security
          sourcetype: WinEventLog
      test_type: unit

Stages and Predicates

Stage 1: search

`wineventlog_security` EventCode=4698 OR EventCode=4699

Stage 2: xmlkv

| xmlkv Message

Stage 3: transaction implicit 300s window

| transaction Task_Name  startswith=(EventCode=4698) endswith=(EventCode=4699)

Stage 4: eval

| eval short_lived=case((duration<30),"TRUE")
short_lived =
else"TRUE"

Stage 5: search

| search  short_lived = TRUE

Stage 6: rename

| rename ComputerName as dest

Stage 7: table

| table _time, dest, Account_Name, Command, Task_Name, short_lived

Stage 8: search

| `short_lived_scheduled_task_filter`

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventCodeeq
  • 4698 corpus 14 (splunk 14)
  • 4699
short_livedeq
  • TRUE corpus 5 (splunk 5)