Detection rules › Elastic

Scheduled Task by a Low Reputation Process

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

Identifies the creation of a scheduled task by a process with low or unknown reputation. This behavior is consistent with an adversary attempting to establish persistence after initial access via malicious user execution.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the creation of a scheduled task by a process with low or unknown reputation. This behavior is consistent
with an adversary attempting to establish persistence after initial access via malicious user execution.
"""
id = "6fa88d6b-e4cf-4862-ad8e-7c7022773e74"
license = "Elastic License v2"
name = "Scheduled Task by a Low Reputation Process"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd/daily-trigger-example--xml-"]
version = "1.0.7"

query = '''
sequence with maxspan=5m
 [process where event.action == "start" and
  (process.Ext.relative_file_creation_time <= 1800 or process.Ext.relative_file_name_modify_time <= 1800) and
  (process.code_signature.trusted == false or process.code_signature.exists == false) and
  not process.code_signature.status : "errorCode_endpoint*" and
  process.pe.imphash != "28a18f58924d2f4dd2bffbbc85a12952" and
  not process.hash.sha256 in ("fe2e331c46bd04e56d2417ff88ebce72675750aab701105086010a570f1afe62",
                             "81fac89743d43b741a009541a9c365ed3213f49cf6314d9c50418ab0d9e82528",
                             "5e68632b85501280c7378d20a287d40896243f1538e284d83f35f8b3aea98660",
                             "52e1e3053aadaccf78837dffaaa6f9ed41b201e0019f22a4880a5327d7650206",
                             "c67dc4d06f07584f4ac0f0b3882ae5f7479676014e6caa65eadc47f49d37ce13",
                             "c897af6b2f9d8a544e248862d975314478a75e6a3c5546fe643fb884afde44c6",
                             "63159f0a972d79169616f752dad5ccf79a9e468392eb9396fda34bc5cabebb3e",
                             "941f4d0a95fd0f32c484d30e3b14e4016e2a9f8bf9ea46ebc7f0f22dcdc10e25",
                             "1db9766f6583bb0e19b25df74de71c636893ea5a9b9e6421670667bb30e8d478",
                             "21864b1bd7dfa255eeb45ee8c10c15889a97afc45aed83190d91efca232d7db1")] by process.entity_id
 [file where event.action : "creation" and process.name : "svchost.exe" and
  file.path : ("?:\\Windows\\Tasks\\*", "?:\\Windows\\System32\\Tasks\\*")] by Effective_process.entity_id
'''

min_endpoint_version = "8.10.0"
reputation = true
[[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.10.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
  (process.Ext.relative_file_creation_time <= 1800 or process.Ext.relative_file_name_modify_time <= 1800) and
  (process.code_signature.trusted == false or process.code_signature.exists == false) and
  not process.code_signature.status : "errorCode_endpoint*" and
  process.pe.imphash != "28a18f58924d2f4dd2bffbbc85a12952" and
  not process.hash.sha256 in ("fe2e331c46bd04e56d2417ff88ebce72675750aab701105086010a570f1afe62",
                             "81fac89743d43b741a009541a9c365ed3213f49cf6314d9c50418ab0d9e82528",
                             "5e68632b85501280c7378d20a287d40896243f1538e284d83f35f8b3aea98660",
                             "52e1e3053aadaccf78837dffaaa6f9ed41b201e0019f22a4880a5327d7650206",
                             "c67dc4d06f07584f4ac0f0b3882ae5f7479676014e6caa65eadc47f49d37ce13",
                             "c897af6b2f9d8a544e248862d975314478a75e6a3c5546fe643fb884afde44c6",
                             "63159f0a972d79169616f752dad5ccf79a9e468392eb9396fda34bc5cabebb3e",
                             "941f4d0a95fd0f32c484d30e3b14e4016e2a9f8bf9ea46ebc7f0f22dcdc10e25",
                             "1db9766f6583bb0e19b25df74de71c636893ea5a9b9e6421670667bb30e8d478",
                             "21864b1bd7dfa255eeb45ee8c10c15889a97afc45aed83190d91efca232d7db1")] by process.entity_id

Stage 2: file

[file where event.action : "creation" and process.name : "svchost.exe" and
  file.path : ("?:\\Windows\\Tasks\\*", "?:\\Windows\\System32\\Tasks\\*")] by Effective_process.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statusstarts_witherrorCode_endpointexcludes:process.code_signature.status field:"process.code_signature.status" value:"errorCode_endpoint"
process.hash.sha256in1db9766f6583bb0e19b25df74de71c636893ea5a9b9e6421670667bb30e8d478, 21864b1bd7dfa255eeb45ee8c10c15889a97afc45aed83190d91efca232d7db1, 52e1e3053aadaccf78837dffaaa6f9ed41b201e0019f22a4880a5327d7650206, 5e68632b85501280c7378d20a287d40896243f1538e284d83f35f8b3aea98660, 63159f0a972d79169616f752dad5ccf79a9e468392eb9396fda34bc5cabebb3e, 81fac89743d43b741a009541a9c365ed3213f49cf6314d9c50418ab0d9e82528, 941f4d0a95fd0f32c484d30e3b14e4016e2a9f8bf9ea46ebc7f0f22dcdc10e25, c67dc4d06f07584f4ac0f0b3882ae5f7479676014e6caa65eadc47f49d37ce13, c897af6b2f9d8a544e248862d975314478a75e6a3c5546fe643fb884afde44c6, fe2e331c46bd04e56d2417ff88ebce72675750aab701105086010a570f1afe62excludes:process.hash.sha256

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionwildcard
  • creation corpus 58 (elastic 58)
field:"EventType" kind:wildcard value:"creation"
file.pathwildcard
  • ?:\Windows\System32\Tasks\* corpus 6 (elastic 6)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
field:"TargetFilename" kind:wildcard
process.Ext.relative_file_creation_timele
  • 1800 transforms: number corpus 6 (elastic 6)
field:"process.Ext.relative_file_creation_time" kind:le value:"1800"
process.Ext.relative_file_name_modify_timele
  • 1800 transforms: number corpus 6 (elastic 6)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"1800"
process.code_signature.existseq
  • false transforms: boolean corpus 119 (elastic 119)
field:"process.code_signature.exists" kind:eq value:"false"
process.code_signature.trustedeq
  • false transforms: boolean corpus 115 (elastic 115)
field:"process.code_signature.trusted" kind:eq value:"false"
process.namewildcard
  • svchost.exe corpus 24 (elastic 22, splunk 2)
field:"process_name" kind:wildcard value:"svchost.exe"
process.pe.imphashne
  • 28a18f58924d2f4dd2bffbbc85a12952 corpus 2 (elastic 2)
field:"Imphash" kind:ne value:"28a18f58924d2f4dd2bffbbc85a12952"