Schtasks Run Task On Demand
Detection of on-demand execution of Windows Scheduled Tasks via the schtasks.exe command-line utility, a common technique for persistence and lateral movement.
This analytic detects the execution of Windows Scheduled Tasks on demand using the schtasks.exe utility. The detection focuses on identifying schtasks.exe being executed with the run command, which is often used by adversaries to force the execution of previously created scheduled tasks. This activity is significant because attackers frequently leverage scheduled tasks for persistent access, privilege escalation, or lateral movement within a compromised network. Detecting this behavior can help defenders identify and respond to malicious activity before it leads to further compromise. The technique has been associated with various threat actors and malware families including Qakbot, XMRig, and Medusa Ransomware as well as campaigns such as CISA AA22-257A and Industroyer2.
Attack Chain
- An attacker gains initial access to the system through various means (e.g., exploiting a vulnerability, phishing).
- The attacker establishes persistence by creating a new scheduled task using
schtasks.exe. - The attacker uses
schtasks.exewith theruncommand to trigger the malicious scheduled task on demand. - The scheduled task executes a malicious payload, such as a script or executable.
- The payload may perform various malicious actions, such as downloading additional malware, escalating privileges, or gathering sensitive information.
- The attacker moves laterally to other systems on the network by creating and running scheduled tasks remotely.
- The attacker attempts to disable security controls or evade detection by modifying existing scheduled tasks.
- The attacker achieves their final objective, such as data exfiltration, ransomware deployment, or system disruption.
Impact
Successful exploitation can lead to persistent access, lateral movement, and privilege escalation within the compromised environment. Attackers can use this technique to maintain a foothold on the system, spread malware to other systems on the network, and ultimately achieve their objectives, such as data theft, ransomware deployment, or disruption of critical services.
Recommendation
- Deploy the provided Sigma rule to your SIEM to detect the execution of
schtasks.exewith theruncommand, tuning it to exclude known legitimate uses. - Investigate any detected instances of
schtasks.exeexecution with theruncommand to determine if they are malicious. - Monitor process execution data for unusual or unexpected processes being launched by scheduled tasks.
- Implement strict access controls and regularly review and audit scheduled tasks to prevent unauthorized modifications or creations.
- Enable Sysmon process-creation logging (Event ID 1) to capture detailed information about process executions, including command-line arguments.
Detection coverage 2
Schtasks Run Task On Demand
mediumDetects the execution of schtasks.exe with the run command, indicating a scheduled task being triggered on demand.
Schtasks TaskName Parameter Manipulation
mediumDetects attempts to bypass task name validation or obfuscate task names when using schtasks.exe
Detection queries are kept inside the platform. Get full rules →