Technique
ID T1053
Tactic Execution, Persistence, Privilege Escalation
Platform Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP, Windows 7, Windows 8, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012 R2, Windows Vista, Windows 8.1, Windows 10
Data Sources File monitoring, Process command-line parameters, Process monitoring
Supports Remote Yes
CAPEC ID CAPEC-557

Utilities such as at and schtasks, along with the Windows Task Scheduler, can be used to schedule programs or scripts to be executed at a date and time. The account used to create the task must be in the Administrators group on the local system. A task can also be scheduled on a remote system, provided the proper authentication is met to use RPC and file and printer sharing is turned on.1

An adversary may use task scheduling to execute programs at system startup or on a scheduled basis for persistence, to conduct remote Execution as part of Lateral Movement, to gain SYSTEM privileges, or to run a process under the context of a specified account.

## Examples

• APT18 actors used the native at Windows task scheduler tool to use scheduled tasks for execution on a victim network.2
• APT29 used named and hijacked scheduled tasks to establish persistence.3
• An APT3 downloader creates persistence by creating the following scheduled task: schtasks /create /tn "mysc" /tr C:\Users\Public\test.exe /sc ONLOGON /ru "System".4
• APT32 has used scheduled tasks to persist on victim systems.5
• FIN10 has established persistence by using S4U tasks as well as the Scheduled Task option in PowerShell Empire.67
• FIN6 has used scheduled tasks to establish persistence for various malware it uses, including downloaders known as HARDTACK and SHIPBREAD and PoS malware known as TRINITY.8
• FIN7 malware has created scheduled tasks to establish persistence.910
• Stealth Falcon malware creates a scheduled task entitled “IE Web Cache” to execute a malicious file hourly.11
• Threat Group-3390 actors use at to schedule tasks to run self-extracting RAR archives, which install HTTPBrowser or PlugX on other victims on a network.
• menuPass has used a script (atexec.py) to execute a command on a target machine via Task Scheduler.12
• CosmicDuke uses scheduled tasks typically named "Watchmon Service" for persistence.13
• One persistence mechanism used by CozyCar is to register itself as a scheduled task.14
• Adversaries can instruct Duqu to spread laterally by copying itself to shares it has enumerated and for which it has obtained legitimate credentials (via keylogging or other means). The remote host is then infected by using the compromised credentials to schedule a task on remote machines that executes the malware.15
• JHUHUGIT has registered itself as a scheduled task to run each time the current user logs in.1617
• Pteranodon schedules tasks to invoke its components in order to establish persistence.18
• Remsec schedules the execution one of its modules by creating a new scheduler task.20
• Shamoon copies an executable payload to the target system by using Windows Admin Shares and then scheduling an unnamed task to execute the malware.2122
• at can be used to schedule a task on a system.23
• schtasks is used to schedule tasks on a Windows system to run at a specific date and time.24

## Mitigation

Limit privileges of user accounts and remediate Privilege Escalation vectors so only authorized administrators can create scheduled tasks. Toolkits like the PowerSploit framework contain PowerUp modules that can be used to explore systems for permission weaknesses in scheduled tasks that could be used to escalate privileges.25

Identify and block unnecessary system utilities or potentially malicious software that may be used to schedule tasks using whitelisting26 tools, like AppLocker,2728 or Software Restriction Policies29 where appropriate.30

## Detection

Monitor scheduled task creation from common utilities using command-line invocation. Legitimate scheduled tasks may be created during installation of new software or through system administration functions. Monitor process execution from the Windows Task Scheduler taskeng.exe. If scheduled tasks are not used for persistence, then the adversary is likely to remove the task when the action is complete. Monitor Windows Task Scheduler stores in %systemroot%\System32\Tasks for change entries related to scheduled tasks that do not correlate with known software, patch cycles, etc. Data and events should not be viewed in isolation, but as part of a chain of behavior that could lead to other activities, such as network connections made for Command and Control, learning details about the environment through Discovery, and Lateral Movement.

Tools such as Sysinternals Autoruns may also be used to detect system changes that could be attempts at persistence, including listing current scheduled tasks.31 Look for changes to tasks that do not correlate with known software, patch cycles, etc. Suspicious program execution through scheduled tasks may show up as outlier processes that have not been seen before when compared against historical data.

Monitor processes and command-line arguments for actions that could be taken to create tasks. Remote access tools with built-in features may interact directly with the Windows API to perform these functions outside of typical system utilities. Tasks may also be created through Windows system management tools such as Windows Management Instrumentation and PowerShell, so additional logging may need to be configured to gather the appropriate data.