Local Scheduled Task Creation

Indicates the creation of a scheduled task. Adversaries can use these to establish persistence, move laterally, and/or escalate privileges.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/02/18"
 3integration = ["endpoint", "windows"]
 4maturity = "production"
 5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
 6min_stack_version = "8.3.0"
 7updated_date = "2024/03/28"
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Indicates the creation of a scheduled task. Adversaries can use these to establish persistence, move laterally, and/or
13escalate privileges.
14"""
15false_positives = ["Legitimate scheduled tasks may be created during installation of new software."]
16from = "now-9m"
17index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.sysmon_operational-*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Local Scheduled Task Creation"
21references = [
22    "https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-1",
23    "https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-2",
24]
25risk_score = 21
26rule_id = "afcce5ad-65de-4ed2-8516-5e093d3ac99a"
27severity = "low"
28tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Persistence", "Data Source: Elastic Defend", "Data Source: Sysmon"]
29type = "eql"
30
31query = '''
32sequence with maxspan=1m
33  [process where host.os.type == "windows" and event.type != "end" and
34    ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
35                      "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or
36    process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
37                                     "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe",
38                                     "winrshost.exe")) or
39    ?process.code_signature.trusted == false)] by process.entity_id
40  [process where host.os.type == "windows" and event.type == "start" and
41    (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and
42    process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and
43    /* exclude SYSTEM Integrity Level - look for task creations by non-SYSTEM user */
44    not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
45  ] by process.parent.entity_id
46'''
47
48
49[[rule.threat]]
50framework = "MITRE ATT&CK"
51[[rule.threat.technique]]
52id = "T1053"
53name = "Scheduled Task/Job"
54reference = "https://attack.mitre.org/techniques/T1053/"
55[[rule.threat.technique.subtechnique]]
56id = "T1053.005"
57name = "Scheduled Task"
58reference = "https://attack.mitre.org/techniques/T1053/005/"
59
60
61
62[rule.threat.tactic]
63id = "TA0003"
64name = "Persistence"
65reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top