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"
 5updated_date = "2024/10/15"
 6min_stack_version = "8.14.0"
 7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
 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    "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine",
25    "https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
26]
27risk_score = 21
28rule_id = "afcce5ad-65de-4ed2-8516-5e093d3ac99a"
29severity = "low"
30tags = [
31    "Domain: Endpoint",
32    "OS: Windows",
33    "Use Case: Threat Detection",
34    "Tactic: Persistence",
35    "Data Source: Elastic Defend",
36    "Data Source: Sysmon",
37]
38type = "eql"
39
40query = '''
41sequence with maxspan=1m
42  [process where host.os.type == "windows" and event.type != "end" and
43    ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
44                      "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or
45    process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
46                                     "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe",
47                                     "winrshost.exe")) or
48    ?process.code_signature.trusted == false)] by process.entity_id
49  [process where host.os.type == "windows" and event.type == "start" and
50    (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and
51    process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and
52    /* exclude SYSTEM Integrity Level - look for task creations by non-SYSTEM user */
53    not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
54  ] by process.parent.entity_id
55'''
56
57
58[[rule.threat]]
59framework = "MITRE ATT&CK"
60[[rule.threat.technique]]
61id = "T1053"
62name = "Scheduled Task/Job"
63reference = "https://attack.mitre.org/techniques/T1053/"
64[[rule.threat.technique.subtechnique]]
65id = "T1053.005"
66name = "Scheduled Task"
67reference = "https://attack.mitre.org/techniques/T1053/005/"
68
69
70
71[rule.threat.tactic]
72id = "TA0003"
73name = "Persistence"
74reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top