sequence with maxspan=1m
[process where host.os.type == "windows" and event.type == "start" 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 host.os.type == "windows" and 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
Install detection rules in Elastic Security
Detect Local Scheduled Task Creation in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).