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