Detection of Remote Scheduled Task Initiation via Schtasks
This brief describes the detection of adversaries abusing 'schtasks.exe' for lateral movement and remote code execution by triggering scheduled tasks on remote Windows endpoints.
Adversaries frequently abuse the Windows Task Scheduler as a living-off-the-land technique to facilitate lateral movement and achieve remote code execution within a compromised network. By leveraging the built-in 'schtasks.exe' utility, threat actors can trigger existing scheduled tasks on remote systems, often bypassing traditional perimeter defenses. This activity is a hallmark of post-exploitation operations, including those attributed to ransomware groups and state-sponsored actors who prioritize stealthy, built-in system administration tools to maintain access and execute malicious payloads across an enterprise environment. Detection engineering teams must focus on monitoring process execution telemetry for command lines that indicate remote task interaction to identify and contain such movement early in the attack lifecycle.
Attack Chain
- Attacker gains initial access to a workstation or server via phishing, exploit, or credential theft.
- Attacker performs internal reconnaissance to identify high-value targets or domain-joined workstations.
- Attacker uses compromised credentials to authenticate to a remote system over SMB or WinRM.
- Attacker identifies a persistent scheduled task on the remote system to abuse or creates a new one.
- Attacker executes 'schtasks.exe /S <remote_host> /run /TN <task_name>' to invoke the task remotely.
- The remote host executes the command defined in the task, resulting in remote code execution (RCE).
- Attacker leverages this RCE to deploy secondary payloads, exfiltrate data, or move laterally to further systems.
Impact
Successful abuse of remote scheduled tasks allows an attacker to execute arbitrary code with the privileges associated with the task. This facilitates lateral movement, privilege escalation, and persistence across the Windows domain. If left undetected, this technique can lead to full domain compromise, large-scale ransomware deployment, or long-term covert data exfiltration.
Recommendation
- Deploy the Sigma rule provided in this brief to detect remote task initiation attempts across your Windows server and workstation fleet.
- Enable Sysmon Event ID 1 or Windows Event ID 4688 to capture comprehensive process creation command-line logs.
- Map all process execution logs to the CIM 'Processes' data model to ensure detection logic functions correctly.
- Investigate occurrences of 'schtasks.exe' connecting to remote endpoints; tune alerts to identify deviations from known administrative service accounts.
Immediate actions
Deploy the provided Sigma rule to detect remote schtasks activity.
Threat Hunt
Search for anomalous schtasks.exe command lines in existing process logs.
Data: Process creation events
Mitigations
Restrict the ability of standard users to execute remote commands via schtasks.
T1053.005
Detection coverage 1
Detect Remote Scheduled Task Initiation via Schtasks
mediumDetects the use of 'schtasks.exe' with the /S and /run flags to trigger a scheduled task on a remote endpoint, often used for lateral movement.
Detection queries are available on the platform. Get full rules →