Local Scheduled Task Creation
editLocal Scheduled Task Creation
editIndicates the creation of a scheduled task. Adversaries can use these to establish persistence, move laterally, and/or escalate privileges.
Rule type: eql
Rule indices:
- winlogbeat-*
- logs-endpoint.events.*
- logs-windows.*
Severity: low
Risk score: 21
Runs every: 5 minutes
Searches indices from: now-9m (Date Math format, see also Additional look-back time
)
Maximum alerts per execution: 100
Tags:
- Elastic
- Host
- Windows
- Threat Detection
- Persistence
Version: 13 (version history)
Added (Elastic Stack release): 7.6.0
Last modified (Elastic Stack release): 8.4.0
Rule authors: Elastic
Rule license: Elastic License v2
Potential false positives
editLegitimate scheduled tasks may be created during installation of new software.
Rule query
editsequence with maxspan=1m [process where event.type != "end" and ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe")) or process.code_signature.trusted == false)] by process.entity_id [process where event.type == "start" and (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and /* exclude SYSTEM Integrity Level - look for task creations by non-SYSTEM user */ not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System") ] by process.parent.entity_id
Threat mapping
editFramework: MITRE ATT&CKTM
-
Tactic:
- Name: Persistence
- ID: TA0003
- Reference URL: https://attack.mitre.org/tactics/TA0003/
-
Technique:
- Name: Scheduled Task/Job
- ID: T1053
- Reference URL: https://attack.mitre.org/techniques/T1053/
Rule version history
edit- Version 13 (8.4.0 release)
-
- Formatting only
- Version 12 (8.2.0 release)
-
-
Updated query, changed from:
sequence with maxspan=1m [process where event.type != "end" and ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe")) or process.code_signature.trusted == false)] by process.entity_id [process where event.type == "start" and (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and /* exclude SYSTEM Integrity Level - look for task creations by non-SYSTEM user */ not (process.Ext.token.integrity_level_name : "System" or winlog.event_data.IntegrityLevel : "System") ] by process.parent.entity_id
-
- Version 10 (8.1.0 release)
-
-
Updated query, changed from:
sequence with maxspan=1m [process where event.type != "end" and ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe")) or process.code_signature.trusted == false)] by process.entity_id [process where event.type == "start" and (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and /* exclude SYSTEM SIDs - look for task creations by non-SYSTEM user */ not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20")] by process.parent.entity_id
-
- Version 9 (7.16.0 release)
-
-
Updated query, changed from:
sequence with maxspan=1m [process where event.type != "end" and ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe", "powershell.exe", "pwsh.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe")) or process.code_signature.trusted == false)] by process.entity_id [process where event.type == "start" and (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and /* exclude SYSTEM SIDs - look for task creations by non-SYSTEM user */ not user.id : ("S-1-5-18", "S-1-5-19", "S-1-5-20")] by process.parent.entity_id
-
- Version 8 (7.13.0 release)
-
- Rule name changed from: Local Scheduled Task Commands
-
Updated query, changed from:
event.category:process and event.type:(start or process_started) and process.name:schtasks.exe and process.args:(-change or -create or -run or -s or /S or /change or /create or /run)
- Version 7 (7.12.0 release)
-
- Formatting only
- Version 6 (7.11.2 release)
-
- Formatting only
- Version 5 (7.10.0 release)
-
- Formatting only
- Version 4 (7.9.1 release)
-
- Formatting only
- Version 3 (7.9.0 release)
-
-
Updated query, changed from:
event.action:"Process Create (rule: ProcessCreate)" and process.name:schtasks.exe and process.args:(-change or -create or -run or -s or /S or /change or /create or /run)
-
- Version 2 (7.7.0 release)
-
-
Updated query, changed from:
event.action:"Process Create (rule: ProcessCreate)" and process.name:schtasks.exe and process.args:("/create" or "-create" or "/S" or "-s" or "/run" or "-run" or "/change" or "-change")
-