Detection rules › Elastic

Scheduled Task Creation from Suspicious Parent

Time window
1m
Sequence by
process.entity_id, process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the creation of a scheduled task from a suspicious parent process. This behavior is consistent with an adversary attempting to establish persistence.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the creation of a scheduled task from a suspicious parent process. This behavior is consistent with an
adversary attempting to establish persistence.
"""
id = "0ce4faf0-1fe4-4455-a152-bd923e1fbdf6"
license = "Elastic License v2"
name = "Scheduled Task Creation from Suspicious Parent"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd"]
version = "1.0.5"

query = '''
sequence with maxspan=1m
 [process where event.action == "start" and
  (
   (process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and
    not process.executable : "C:\\*") or

   ((process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
     not process.code_signature.status : "trusted") or

   (process.executable :
	        ("?:\\Users\\*\\AppData\\*",
	         "?:\\Users\\*\\Downloads\\*",
	         "?:\\Users\\*\\Desktop\\*",
	         "?:\\Users\\Public\\*",
	         "\\Device\\Mup*") and not process.code_signature.status : "trusted")
   ) and 
   not process.executable : "?:\\Program Files\\WinCompose\\wincompose.exe" and 
   not process.hash.sha256 : "fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478"] by process.entity_id
  [process where event.action == "start" and
   (process.pe.original_file_name : "schtasks.exe" or process.name : "schtasks.exe") and
   not process.Ext.token.integrity_level_name == "system" and
   process.args : ("/create", "-create") and process.args : "/tr" and
   not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*")] by process.parent.entity_id
'''

min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.

Stage 1: process

[process where event.action == "start" and
  (
   (process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and
    not process.executable : "C:\\*") or

   ((process.Ext.relative_file_creation_time <= 900 or process.Ext.relative_file_name_modify_time <= 900) and
     not process.code_signature.status : "trusted") or

   (process.executable :
	        ("?:\\Users\\*\\AppData\\*",
	         "?:\\Users\\*\\Downloads\\*",
	         "?:\\Users\\*\\Desktop\\*",
	         "?:\\Users\\Public\\*",
	         "\\Device\\Mup*") and not process.code_signature.status : "trusted")
   ) and 
   not process.executable : "?:\\Program Files\\WinCompose\\wincompose.exe" and 
   not process.hash.sha256 : "fef078893ac6b23a7412b0b757f6e24631db84133cc420a9844e1e64212e4478"] by process.entity_id

Stage 2: process

[process where event.action == "start" and
   (process.pe.original_file_name : "schtasks.exe" or process.name : "schtasks.exe") and
   not process.Ext.token.integrity_level_name == "system" and
   process.args : ("/create", "-create") and process.args : "/tr" and
   not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*")] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.Ext.device.product_idwildcard
  • USB *
  • Virtual DVD-ROM corpus 13 (elastic 13)
  • Virtual Disk corpus 13 (elastic 13)
field:"process.Ext.device.product_id" kind:wildcard
process.Ext.relative_file_creation_timele
  • 900 transforms: number corpus 7 (elastic 7)
field:"process.Ext.relative_file_creation_time" kind:le value:"900"
process.Ext.relative_file_name_modify_timele
  • 900 transforms: number corpus 6 (elastic 6)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"900"
process.argswildcard
  • -create corpus 6 (elastic 6)
  • /create corpus 7 (elastic 7)
  • /tr corpus 4 (elastic 4)
field:"process.args" kind:wildcard
process.executablewildcard
  • ?:\Users\*\AppData\* corpus 12 (elastic 12)
  • ?:\Users\*\Desktop\* corpus 3 (elastic 3)
  • ?:\Users\*\Downloads\* corpus 12 (elastic 12)
  • ?:\Users\Public\* corpus 4 (elastic 4)
  • \Device\Mup* corpus 4 (elastic 4)
field:"Image" kind:wildcard
process.namewildcard
  • schtasks.exe corpus 30 (elastic 19, splunk 11)
field:"process_name" kind:wildcard value:"schtasks.exe"
process.pe.original_file_namewildcard
  • schtasks.exe corpus 31 (sigma 18, elastic 9, splunk 4)
field:"OriginalFileName" kind:wildcard value:"schtasks.exe"