Detection rules › Elastic

Scheduled Task Creation via Unsigned Parent

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

Identifies the creation of a scheduled task using schtasks.exe utility and from a recently dropped unsigned 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 using schtasks.exe utility and from a recently dropped unsigned parent
process. This behavior is consistent with an adversary attempting to establish persistence.
"""
id = "bcafc042-2aaa-4011-8650-1621e3bd6807"
license = "Elastic License v2"
name = "Scheduled Task Creation via Unsigned Parent"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd"]
version = "1.0.16"

query = '''
sequence by user.id with maxspan=3m
 [process where event.action == "start" and
  (process.Ext.relative_file_creation_time <= 500 or process.Ext.relative_file_name_modify_time <= 500) and
  not process.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
  not process.hash.sha256 : ("d0766b7caa8a7ee828f776116e564e5f231307cb748eb4b9164fa679a88185ca",
                             "6b509b774512fcd3581c321040119bf412a308c20d681575170a3a21078225b7",
                             "84efcc024b5f6de6554c40033462b21ca550a240c84e46b36ebb972799aa8a8b",
                             "5781e4524a79859f2f5097829d5a848a47529181a0cc34342f298d77ab31209f",
                             "7e2afab5c7bda9ed6b308807757dbd5aecd572a02edb540b7cb8c98865d21278",
                             "d678d9b1ecb942d88c39c23cd93884b28f6fe0792e2a122e8f1b00c2e34dde27",
                             "830b7954516ca041fe9aba5e472023002236773aa9f2482a2025706b4536b8d0")
  ] by process.entity_id
 [process where event.action == "start" and
  (process.pe.original_file_name : ("schtasks.exe", "sctasks.exe", "cmd.exe", "powershell.exe") or 
   process.name : ("schtasks.exe", "cmd.exe", "powershell.exe")) and
  not process.Ext.token.integrity_level_name == "system" and
  process.args : ("/create", "-create") and process.args : "/tr"] by process.parent.entity_id
'''

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

[[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 3m, correlated by process.entity_id, process.parent.entity_id, user.id.

Stage 1: process

[process where event.action == "start" and
  (process.Ext.relative_file_creation_time <= 500 or process.Ext.relative_file_name_modify_time <= 500) and
  not process.code_signature.status : ("trusted", "errorExpired", "errorCode_endpoint*") and
  not process.hash.sha256 : ("d0766b7caa8a7ee828f776116e564e5f231307cb748eb4b9164fa679a88185ca",
                             "6b509b774512fcd3581c321040119bf412a308c20d681575170a3a21078225b7",
                             "84efcc024b5f6de6554c40033462b21ca550a240c84e46b36ebb972799aa8a8b",
                             "5781e4524a79859f2f5097829d5a848a47529181a0cc34342f298d77ab31209f",
                             "7e2afab5c7bda9ed6b308807757dbd5aecd572a02edb540b7cb8c98865d21278",
                             "d678d9b1ecb942d88c39c23cd93884b28f6fe0792e2a122e8f1b00c2e34dde27",
                             "830b7954516ca041fe9aba5e472023002236773aa9f2482a2025706b4536b8d0")
  ] by process.entity_id

Stage 2: process

[process where event.action == "start" and
  (process.pe.original_file_name : ("schtasks.exe", "sctasks.exe", "cmd.exe", "powershell.exe") or 
   process.name : ("schtasks.exe", "cmd.exe", "powershell.exe")) and
  not process.Ext.token.integrity_level_name == "system" and
  process.args : ("/create", "-create") and process.args : "/tr"] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statuswildcardtrusted, errorExpired, errorCode_endpoint*excludes:process.code_signature.status field:"process.code_signature.status" value:"trusted" field:"process.code_signature.status" value:"errorExpired" field:"process.code_signature.status" value:"errorCode_endpoint*"
process.hash.sha256eqd0766b7caa8a7ee828f776116e564e5f231307cb748eb4b9164fa679a88185ca, 6b509b774512fcd3581c321040119bf412a308c20d681575170a3a21078225b7, 84efcc024b5f6de6554c40033462b21ca550a240c84e46b36ebb972799aa8a8b, 5781e4524a79859f2f5097829d5a848a47529181a0cc34342f298d77ab31209f, 7e2afab5c7bda9ed6b308807757dbd5aecd572a02edb540b7cb8c98865d21278, d678d9b1ecb942d88c39c23cd93884b28f6fe0792e2a122e8f1b00c2e34dde27, 830b7954516ca041fe9aba5e472023002236773aa9f2482a2025706b4536b8d0excludes:process.hash.sha256
process.Ext.token.integrity_level_nameeqsystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system"

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.relative_file_creation_timele
  • 500 transforms: number corpus 28 (elastic 28)
field:"process.Ext.relative_file_creation_time" kind:le value:"500"
process.Ext.relative_file_name_modify_timele
  • 500 transforms: number corpus 21 (elastic 21)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"500"
process.argswildcard
  • -create corpus 6 (elastic 6)
  • /create corpus 7 (elastic 7)
  • /tr corpus 4 (elastic 4)
field:"process.args" kind:wildcard
process.namewildcard
  • cmd.exe corpus 121 (elastic 92, splunk 29)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • schtasks.exe corpus 30 (elastic 19, splunk 11)
field:"process_name" kind:wildcard
process.pe.original_file_namewildcard
  • cmd.exe corpus 81 (sigma 43, elastic 21, splunk 17)
  • powershell.exe corpus 138 (sigma 84, splunk 30, elastic 24)
  • schtasks.exe corpus 31 (sigma 18, elastic 9, splunk 4)
  • sctasks.exe
field:"OriginalFileName" kind:wildcard