T1053.005
Scheduled Task
Adversaries may abuse the Windows Task Scheduler to perform task scheduling for initial or recurring execution of malicious code. Attackers use schtasks.exe, the Task Scheduler GUI, .NET wrappers, WMI (via Win32_ScheduledJob or PS_ScheduledTask), or direct registry manipulation to create, modify, or delete scheduled tasks. Tasks can run under any account context including SYSTEM, enabling privilege escalation. Adversaries also create hidden tasks by deleting the Security Descriptor (SD) registry value, making tasks invisible to standard enumeration tools.
Microsoft Sentinel / Defender
kusto
let SuspiciousTaskPatterns = dynamic([
"cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe",
"mshta.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe",
"bitsadmin.exe", "msbuild.exe", "wmic.exe", "msiexec.exe"
]);
let SuspiciousLocations = dynamic([
"\\AppData\\", "\\Temp\\", "\\ProgramData\\", "\\Public\\",
"\\Users\\Default\\", "%temp%", "%appdata%", "%public%"
]);
let SuspiciousSchtasksArgs = dynamic([
"/sc onlogon", "/sc onstart", "/sc onstartup", "/ru system",
"/ru \"system\"", "http://", "https://", "\\\\\\\\"
]);
// Branch 1: schtasks.exe process creation with suspicious patterns
let SchtasksExecution = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "schtasks.exe"
| where ProcessCommandLine has_any ("/create", "/change")
| extend HasSuspiciousLoc = ProcessCommandLine has_any (SuspiciousLocations)
| extend HasSuspiciousBin = ProcessCommandLine has_any (SuspiciousTaskPatterns)
| extend RunAsSystem = ProcessCommandLine has_any ("/ru system", "/ru \"SYSTEM\"", "/ru \"NT AUTHORITY\\SYSTEM\"")
| extend RemoteTask = ProcessCommandLine has "/s "
| extend OnLogonTrigger = ProcessCommandLine has_any ("/sc onlogon", "/sc onstartup", "/sc onstart")
| extend HighFreqTrigger = ProcessCommandLine has_any ("/sc minute", "/sc hourly")
| extend SuspicionScore = toint(HasSuspiciousLoc) + toint(HasSuspiciousBin) + toint(RunAsSystem) + toint(RemoteTask) + toint(OnLogonTrigger) + toint(HighFreqTrigger)
| where SuspicionScore > 0
| extend DetectionSource = "schtasks_process"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
HasSuspiciousLoc, HasSuspiciousBin, RunAsSystem, RemoteTask,
OnLogonTrigger, HighFreqTrigger, SuspicionScore, DetectionSource;
// Branch 2: Suspicious parent processes spawning schtasks
let SuspiciousParentSchtasks = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "schtasks.exe"
| where InitiatingProcessFileName in~ ("powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe",
"cscript.exe", "mshta.exe", "rundll32.exe", "regsvr32.exe", "msiexec.exe",
"wmic.exe", "explorer.exe", "winword.exe", "excel.exe", "outlook.exe",
"acrord32.exe", "msedge.exe", "chrome.exe", "firefox.exe")
| extend SuspicionScore = 2
| extend DetectionSource = "suspicious_parent"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
HasSuspiciousLoc=false, HasSuspiciousBin=false, RunAsSystem=false,
RemoteTask=false, OnLogonTrigger=false, HighFreqTrigger=false,
SuspicionScore, DetectionSource;
// Branch 3: Task Scheduler registry writes to suspicious paths
let RegistryTaskCreation = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Schedule\\TaskCache\\"
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| where InitiatingProcessFileName !in~ ("svchost.exe", "taskeng.exe", "taskhostw.exe", "TaskScheduler")
| extend SuspicionScore = 1
| extend DetectionSource = "registry_task"
| project Timestamp=Timestamp, DeviceName, AccountName=InitiatingProcessAccountName,
FileName=InitiatingProcessFileName,
ProcessCommandLine=InitiatingProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
HasSuspiciousLoc=false, HasSuspiciousBin=false, RunAsSystem=false,
RemoteTask=false, OnLogonTrigger=false, HighFreqTrigger=false,
SuspicionScore, DetectionSource;
union SchtasksExecution, SuspiciousParentSchtasks, RegistryTaskCreation
| sort by Timestamp desc high severity
high confidence
Data Sources
Process: Process Creation Registry: Registry Key Creation Registry: Registry Value Modification Microsoft Defender for Endpoint
Required Tables
DeviceProcessEvents DeviceRegistryEvents
False Positives
- Software installers and patch management tools (SCCM, Intune, PDQ Deploy) that create scheduled tasks as part of software deployment workflows
- Legitimate IT automation and monitoring agents (SolarWinds, Nagios, Datadog, Ansible) that create or modify scheduled tasks for health checks and data collection
- Antivirus and endpoint security products creating scheduled tasks for definition updates, scans, and health monitoring
- Developer and DevOps toolchains (CI/CD agents, build servers) that schedule recurring jobs via schtasks
- System administrators manually creating maintenance tasks from elevated shells during change windows
Last updated: 2026-04-16 Research depth: deep
References (11)
- https://attack.mitre.org/techniques/T1053/005/
- https://www.microsoft.com/security/blog/2022/04/12/tarrask-malware-uses-scheduled-tasks-for-defense-evasion/
- https://blog.qualys.com/vulnerabilities-threat-research/2022/06/20/defending-against-scheduled-task-attacks-in-windows-environments/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1053.005/T1053.005.md
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_delete/registry_delete_schtasks_hide_task_via_sd_value_removal.yml
- https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/audit-other-object-access-events
- https://technet.microsoft.com/library/dd315590.aspx
- https://learn.microsoft.com/en-us/sysinternals/downloads/autoruns
- https://www.proofpoint.com/us/blog/threat-insight/serpent-no-swiping-new-backdoor-targets-french-entities-unique-attack-chain
- https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page
- https://social.technet.microsoft.com/Forums/en-US/e5bca729-52e7-4fcb-ba12-3225c564674c/scheduled-tasks-history-retention-settings?forum=winserver8gen
Unlock Pro Content
Get the full detection package for T1053.005 including response playbook, investigation guide, and atomic red team tests.
Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance