Scheduled Task

From ATT&CK
Jump to: navigation, search
Scheduled Task
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
Permissions Required Administrator, SYSTEM
Effective Permissions Administrator, SYSTEM
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

  • APT29 used named and hijacked scheduled tasks to establish persistence.2
  • 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".3
  • APT18 actors used the native at Windows task scheduler tool to use scheduled tasks for execution on a victim network.4
  • 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.
  • 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.5
  • Stealth Falcon malware creates a scheduled task entitled “IE Web Cache” to execute a malicious file hourly.6
  • 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.7
  • JHUHUGIT has registered itself as a scheduled task to run each time the current user logs in.8
  • One persistence mechanism used by CozyCar is to register itself as a scheduled task.9
  • CosmicDuke uses scheduled tasks typically named "Watchmon Service" for persistence.10
  • at can be used to schedule a task on a system.11
  • schtasks is used to schedule tasks on a Windows system to run at a specific date and time.12
  • Remsec schedules the execution one of its modules by creating a new scheduler task.13
  • Shamoon copies an executable payload to the target system by using Windows Admin Shares and then scheduling an unnamed task to execute the malware.1415

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.16

Identify and block unnecessary system utilities or potentially malicious software that may be used to schedule tasks using whitelisting17 tools, like AppLocker,1819 or Software Restriction Policies20 where appropriate.21

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.22 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.

References