Blog

Emulating T1053.005: How the Windows Task Scheduler is used by different APT groups.


Fahad Faisal Cyber Security Researcher Intern

I have been researching how Windows Task Scheduler is used for malicious purposes by different APT groups and found out that this is a very common technique used by various APT groups for their intrusions. Windows Task Scheduler is a built-in Windows utility for creating and managing scheduled tasks. It provides trigger logic, execution contexts, registration, and integration with system services, making it useful for enterprise administration. A scheduled task can survive a reboot, run when a user logs in, respond to system events, and execute programs, scripts, or commands. These characteristics make scheduled tasks very useful for legitimate automation, but this properties also attract malicious activity. And most importantly, a malicious task can look completely normal and it does not need to have a suspicious name or a malicious file path. A threat actor can create a task that looks like routine Windows maintenance, software updates, monitoring, or administration to blend into the normal enterprise operations.

Figure 1 - Why Windows Task Scheduler matters for threat detection.

From my research on the various campaigns that abuse the Windows Task Scheduler by different APT groups, the most common malicious use of Task Scheduler I have seen is persistence. A task can relaunch malware after a reboot or can execute a payload according to a configured schedule. The process that creates or registers the task does not need to remain running, so what that means is that once the task has been registered, Windows continues to manage the execution relationship with the created task and its process. This is one of the properties of the scheduled tasks that attracts the threat actors more.

Why T1053.005 matters?

MITRE ATT&CK classifies abuse of Windows Task Scheduler as T1053.005 - Scheduled Task/Job: Scheduled Task.

Figure 2 - MITRE ATT&CK T1053.005 Scheduled Task/Job: Scheduled Task.

When I started looking into how threat actors use Task Scheduler, I realized that this technique is very useful for them because it combines three flexible properties that a threat actor generally wants in an intrusion. The attacker can control when and what an action needs to execute and under which identity or security context it runs. This combination makes scheduled tasks more than a persistence mechanism. Depending on how they are created and configured it can be used to support execution, persistence, privilege changes, remote execution or defense evasion. This is why T1053.005 is used across a wide range of threat activity, including espionage groups, financial crime groups, ransomware operators, commodity malware, loaders, intrusion frameworks, and enterprise-scale destructive campaigns.

During this research, I have seen scheduled tasks used mostly as a persistence technique by different APT groups, but this properties can also be used as a controlled execution vector. An attacker can configure an action to execute after logon, at system startup, or according to a time-based trigger. This gives the threat actor a reliable way to stage follow-on activity for their part of the intrusion.

Also a scheduled task can act as an execution mechanism. It can launch an executable, PowerShell, cmd.exe, wscript.exe, cscript.exe, a DLL through another executable or a custom loader or application. So this means that the scheduled task does not always launch the final payload directly. And the task creation is not limited to the local system. Administrative mechanisms, WMI, remote management, domain administration, and Group Policy can also be part of a remote task execution workflow. So these features strongly influence the role of Scheduled Tasks in an intrusion.

This is why T1053.005 should not only be considered as a persistence technique even though it is used only for persistence by different APT groups, it is also used as an execution mechanism across different malware families, threat actors, and campaigns. How it is being used by a threat actor will be determined by the command, executable, account, trigger, and the activity that follows after the task execution.

Task Model

The Task Scheduler subsystem is made up of task registration, task definitions, triggers, actions, security principals, task settings, and the scheduler service is responsible for evaluating triggers and launching the actions. At the OS level, a scheduled task is a structured object with metadata, execution rules, a security context, and a relationship between the logical task and its underlying artifacts. Microsoft exposes Task Scheduler functionality through COM interfaces and scripting APIs.

Figure 3 - Task Scheduler task model and task structure.

The trigger function determines the timing of execution of the created task. Let's imagine there is a task that runs at startup and there is one that only runs every 30 minutes. The first one may be associated with persistence, but even so, we can't use the trigger alone to determine maliciousness. A task named WindowsUpdate may look normal, but a task named WindowsUpdate that launches C:\Users\\AppData\...\payload.exe can be something else.

Figure 4 - Registry representation of a scheduled task.

The Tasks structure contains task records associated with GUIDs. These records can be correlated with the task hierarchy.

Figure 5 - Scheduled task XML definition.

There are multiple ways to create a scheduled task, so monitoring only one mechanism is not enough. A threat actor can manipulate one representation of a task without removing every associated artifact, but this can leave inconsistencies between Task Scheduler, registry artifacts, and files on disk.

Task Creation Methods

Creation Method Typical Process / Component Visibility Used By
schtasks.exe schtasks.exe High APT29, APT41, FIN7, OilRig, GALLIUM
PowerShell powershell.exe Medium Turla, Kimsuky
WMI / CIM provider processes Medium APT29
COM / API custom process Medium-High Cobalt Group, Trident Ursa
XML registration caller-dependent Variable Diamond Sleet, HAFNIUM
GUI Task Scheduler UI High Not commonly observed in APT operations
Remote administration remote management components Variable Sandworm, Wizard Spider
Group Policy policy processing Lower in endpoint-only telemetry Ryuk operators, FIN6

Table 1 - Task creation methods, their visibility, and which APT groups use them.

How the Task Scheduler gets abused by threat actors?

The scheduled tasks provide a native Windows mechanism for execution and persistence without requiring the original process to remain active. During my research, I have seen this in many places that the threat actors were using this property of the scheduler for their part of the intrusion. A chain of execution can be started with task registration and after some delay, it gets continued by a series of follow-on behavior. So like this, the threat actor uses it to create or alter a task, assigns a trigger such as logon, startup, or a time interval pointing to a PowerShell, WScript, a DLL, or a dropped binary and then executes it under a privileged or stealthy identity account. Once registered, the task can persist the deployed malware across reboots, delay execution, or act as an execution trigger for a later stage.

Figure 6 - Scheduled task trigger and execution flow.

  • Task hijacking and masquerading: Threat actors frequently abuse the fact that tasks can be placed in normal-looking folders or made to look legitimate Windows operations. In many malware chains, the scheduled task is only the initiator. The actual malicious activity begins when the task launches powershell.exe, wscript.exe, or another interpreter that then downloads code, decodes it, and runs the next stage.
  • Changing Task visibility: Task Scheduler maintains multiple representations of a single task. The threat actors can alter Task Scheduler metadata so that tasks are no longer visible through normal enumeration. The task may exist but it may be hidden from standard tools or it may be only partially findable in forensic artifacts.
  • Security descriptor manipulation: Task security descriptors affect who can view, modify, or delete the task. If threat actors alter the associated security information, they can interfere with normal enumeration, hide the task from specific users, or make it harder to identify the true state of the system.

The one thing that appears in many cases is that, the threat actors manipulate the task name, folder, description, author, executable name, payload location, and command line so that the object will look like a routine Windows or enterprise maintenance action rather than looking malicious from the name. In this way, the task will look like a legitimate Windows component or routine task and still point to an untrusted binary, a PowerShell command or a staging script in a user-writable path.

The point is that a legitimate task and a malicious task created by the threat actor can have almost identical names under normal-looking folders, so the difference is not the name itself, it can only be identified based on the execution chain behind it. A legitimate task often points to a signed Microsoft binary and to known software components, but a malicious task may call a script interpreter, execute from a writable location, or launch a recently created file.

Threat actors case study, how the Task Scheduler is used by different APT groups?

In this section, I will walk through how different APT groups have used Task Scheduler in their operations.

Actor Primary Role Technical Pattern
APT29 persistence / operational execution task creation / modification
APT41 persistence / malware execution task-based malware launch
FIN7 persistence / operational execution task and wrapper-based execution
OilRig script execution scheduled script/interpreter chain
GALLIUM implant persistence task to PoisonIvy
Sandworm enterprise execution GPO to scheduled task to payload

Table 2 - APT groups and their primary use of Windows Task Scheduler.

APT29

APT29 also known as Cozy Bear/The Dukes/Midnight Blizzard, is a cyber espionage group assumed to be associated with Russia's SVR (Foreign Intelligence Service). They have been active since at least 2008 and are known for targeting government agencies, think tanks, and diplomatic organizations across Europe and the United States.

One thing I find notable about APT29's approach with the scheduled tasks is that they used it as one of the several mechanisms to maintain execution during their operations. They changed the metadata and characteristics of their scheduled tasks between systems, making simple indicator-based detection less reliable. By using legitimate-looking task names and changing properties across hosts, APT29 made their scheduled tasks blend into normal Windows administrative activity.

One example is, during the SolarWinds compromise, APT29 created tasks on remote hosts as part of lateral movement, set to run as SYSTEM at startup using a command like:

schtasks /create /F /tn "\Microsoft\Windows\SoftwareProtectionPlatform\EventCacheManager"
/tr "C:\Windows\SoftwareDistribution\EventCacheManager.exe"
/sc ONSTART /ru system

The task name was deliberately chosen to masquerade as a legitimate Windows Software Protection Platform component. By placing the malicious executable under C:\Windows\SoftwareDistribution\ and running the task as SYSTEM on startup, APT29 blended their persistence into normal Windows maintenance activity while retaining reliable execution after every reboot.

APT41

APT41 also known as Double Dragon/Wicked Panda/Barium, is a Chinese threat group assumed to be state-sponsored that has been active since at least 2012. What makes them unique is that they operate across both espionage and financially motivated intrusions. They have targeted healthcare, telecom, technology, and gaming sectors, and they are known for supply chain compromises and exploiting public-facing applications.

APT41 used a different model compared to other groups, they did not create a completely new task to achieve persistence, instead the threat actors modified existing Windows tasks that already had higher privileged context, repointing them to malicious execution paths. In a campaign that compromised at least six U.S. state government networks, they gained access through vulnerable internet-facing web applications, then moved quickly into privilege escalation, credential harvesting, Active Directory discovery, and malware deployment. And in this intrusion, Scheduled Tasks became part of the final persistence layer after the actor had already established a strong foothold. They used existing Microsoft task names and changed the underlying execution command to redirect the task toward malicious activity.

The threat actor used SCHTASKS /Change to alter existing system tasks, including tasks under Microsoft paths such as \Microsoft\Windows\PLA\Server Manager Performance Monitor, \Microsoft\Windows\Ras\ManagerMobility, \Microsoft\Windows\WDI\SrvSetupResults, and \Microsoft\Windows\WDI\USOShared. In these cases, the task still looked like a legitimate Windows scheduling object, but the task action was changed to execute a malicious command. One example is modifying the task to launch:

rundll32.exe SHELL32.DLL,ShellExec_RunDLLA
C:\windows\system32\msiexec.exe /Z C:\programdata\S-1-5-18.dat

The adversary was taking an existing seemingly legitimate task and repurposing it for execution.

FIN7

FIN7 also known as Carbanak Group/ITG14, is a financially motivated threat group that has been active since at least 2013. They primarily target the retail, restaurant, and hospitality sectors, and they are well known for large-scale payment card theft operations. Despite multiple arrests of key members, the group has continued to evolve their tooling and tactics over the years.

FIN7 used the scheduled tasks for both delayed execution and persistence. In a campaign, FIN7 delivered a malicious Word document via phishing and then used a JavaScript-based execution chain to create a scheduled task that gets run in the next stage with some delay. The scheduled task was not the initial infection vector, it was part of their staging and persistence logic used after the user opened the malicious document.

The malicious RTF launched obfuscated JavaScript code that copied additional JavaScript fragments into a random working directory and then created a scheduled task to trigger the second stage script within a short interval. This delay helped the threat actors evade immediate behavioral detection and allowed the execution to continue after the initial process had finished. The creation method used by FIN7 was schtasks.exe, invoked from obfuscated macro code to create, run, and delete the tasks directly from the command line.

Figure 7 - FIN7 scheduled task execution chain, taken from respective sources.

FIN7 created a recurring task named AdobeFlashSync to maintain persistence, that gets executed every 25 minutes, repeating the process of rebuilding the JavaScript and launching the next stage. The task name was chosen to masquerade as a legitimate Adobe Flash Player service, a technique documented as T1036.004 - Masquerade Task or Service.

OilRig

OilRig also known as APT34/Helix Kitten/Crambus, is an Iranian cyber espionage group assumed to be associated with Iran's Ministry of Intelligence and Security (MOIS). They have been active since at least 2014 and primarily target organizations in the Middle East, focusing on government, financial, energy, and telecommunications sectors. Their operations rely heavily on custom tooling and social engineering.

The use cases of OilRig are a strong example of script-centric scheduled-task abuse. Across multiple campaigns, the group used trusted Windows scripting components such as wscript.exe and powershell.exe as execution layers for their payloads. The scheduled task appeared benign at first while executing malicious files for persistence. In these cases, OilRig used tasks to invoke a Windows scripting interpreter, which then processes a script or command that leads to the next stage.

One example is, in a campaign that uses the BONDUPDATER backdoor, the initial macro dropped:

C:\ProgramData\WindowsAppPool\AppPool.vbs
C:\ProgramData\WindowsAppPool\AppPool.ps1

The VBScript created a scheduled task named \WindowsAppPool\AppPool configured to execute every minute:

cmd.exe /C schtasks /create /F /sc minute /mo 1
/tn "\WindowsAppPool\AppPool"
/tr "wscript /b C:\ProgramData\WindowsAppPool\AppPool.vbs"

The AppPool.ps1 file contained a variant of the BONDUPDATER backdoor. The scheduled task did not launch the PowerShell payload directly. Instead, it invoked wscript.exe to execute AppPool.vbs, which then launched AppPool.ps1. The critical artifacts in these cases are the interpreter, the arguments, the script file location, the timing of the task creation, and the child processes that get created after the task fires.

GALLIUM

GALLIUM also known as Granite Typhoon, is a Chinese threat group assumed to be state-sponsored that has been active since at least 2012. They are known for targeting telecommunications providers, particularly in Southeast Asia, Europe, and Africa. Their operations focus on gaining persistent access to telecom infrastructure for intelligence collection, and they often use publicly available tools alongside custom malware.

During the Operation Soft Cell campaign, GALLIUM used Scheduled Tasks as a persistence layer for their PoisonIvy implant. In this campaign, the task is used to re-establish connection when the system reboots or the user logs on. The creation method used by GALLIUM was most likely schtasks.exe, given that their operational pattern relied on executing commands through web shells on compromised hosts, though no public report explicitly confirms the exact binary used to register the task.

Figure 8 - PoisonIvy control panel observed during Operation Soft Cell, taken from respective sources.

Thus removing the malicious scheduled task only removes the persistence mechanism represented by that and it does not remove the established PoisonIvy payload, or additional persistence mechanisms that the attacker used for the intrusion.

Sandworm

Sandworm also known as Voodoo Bear/IRIDIUM/Seashell Blizzard, is a Russian military cyber unit assumed to be associated with the GRU's Main Center for Special Technologies (Unit 74455). They have been active since at least 2009 and are responsible for some of the most destructive cyberattacks in history, including NotPetya, the Ukrainian power grid attacks, and Olympic Destroyer. Their operations range from espionage to sabotage and disruption.

In the Prestige ransomware activity, Sandworm used remote execution tooling and highly privileged credentials to deploy the ransomware across multiple hosts. The payload was copied to the remote host through the ADMIN$ share, after that Impacket was used to create a Scheduled Task that executed the ransomware payload.

The attacker already had highly privileged access, staged the payload on the target system, remotely created the task, and then allowed the Task Scheduler to execute the ransomware. The creation method used by Sandworm was Impacket, which remotely creates scheduled tasks over the network via RPC interfaces.

As seen in these cases, the threat actors used the scheduled task for remote payload-deployment, persistence and execution mechanism even after obtaining privileged access. This shows the important point that T1053.005 Scheduled Task/Job: Scheduled Task does not represent a single operational usage. Different threat actors use the same Windows mechanism for persistence, recurring and remote execution, payload deployment, or execution under a privileged security context depending on their intrusion.

APT Emulation of T1053.005 using RedTeamSimmer

We can use RedTeamSimmer, an open-source web-based adversary emulation platform that provides a central interface for selecting Atomic Red Team tests, we can use its agent to run the tests on Windows, collecting live output, and comparing it with the telemetry from our SIEM (we are going to use Elastic Security). This emulation is limited to an isolated, authorized Windows lab system. I will walk through how to set up and run T1053.005 emulations using the RedTeamSimmer Tactics & Techniques inventory.

1. Install and build the RedTeamSimmer Windows agent

Install and compile RedTeamSimmer and its agent. Copy the compiled exe to the designated Windows test machine. Run it as Administrator because many of the Atomic tests require elevation. After starting the agent, log in to the RedTeamSimmer web interface and confirm that it appears as online in the Agents view.

Figure 9 - RedTeamSimmer agent connected and online.

2. Create an emulation plan with RedTeamSimmer

Create a new plan in RedTeamSimmer and browse the local Atomic catalog for T1053.005 - Scheduled Task/Job: Scheduled Task. The technique contains 12 Atomic tests. Select the tests that support the detection scenario being validated.

Figure 10 - Selecting T1053.005 Atomic tests in RedTeamSimmer.

3. Select the agent, run the plan, and review output

Select the confirmed Windows agent as the target, then start the operation. RedTeamSimmer will package and deliver the selected technique content to an extraction endpoint, and show the execution, standard-output, standard-error, duration, and exit-code information in real time. Review the output for every selected test and compare it with your SIEM telemetry.

Figure 11 - Reviewing execution output in RedTeamSimmer.

Video 1 - Running T1053.005 Atomic tests through RedTeamSimmer.

APT emulation for T1053.005 using a custom PowerShell script

For a more actor-specific emulation, I wrote a PowerShell script emulate.ps1 that recreates the malicious scheduled-task behavior of six different APT groups without deploying any malware. Each payload is a harmless local script that records the host, user, process ID, parent process ID, and execution time. This makes it possible to compare scheduler, process-creation, registry, and filesystem telemetry.

Run the script only on an isolated Windows environment that you own or are authorized to test. It requires an elevated PowerShell session and creates its working files under C:\T1053-Lab.

Video 2 - Running the emulate.ps1 APT emulation script.

The emulator script creates lab tasks, deliberately triggers several of them and leaves the non-temporary lab tasks available for inspection. Do not run it on a production endpoint. Review and remove the lab tasks after collecting the evidence you need.

After the emulations, the script exports task definitions and collects the evidence needed to investigate them. Review C:\T1053-Lab\Artifacts for exported task XML, Task Scheduler Operational events, TaskCache\Tree and TaskCache\Tasks registry exports and matching task files from C:\Windows\System32\Tasks. The common payload records its executions in C:\T1053-Lab\Logs\execution.jsonl.

Comparing it with Elastic Security telemetry

After running the emulation, the next question is what did the defender actually see. The RedTeamSimmer execution record is only the ground truth of what happened on the endpoints, and Elastic is what the blue team sees. So by comparing the two, we can measure the actual coverage of the defenses rather than just assuming they work.

I used Elastic Cloud (Serverless) to collect the log sources relevant to scheduled task activity and enabled all prebuilt detection rules targeting T1053.005. The Elastic Agent was deployed on a Windows 11 Pro lab machine running as victim. Sysmon was also installed and configured to log process, file creation, and registry events.

Agent policy and integrations

I created an agent policy called T1053-lab and added the following integrations:

Figure 12 - T1053-lab agent policy and integrations in Elastic Fleet.

  • System integration: collects the Windows Security log. This is where Event IDs 4698 (Event: task created), 4699 (Event: task deleted), 4702 (Event: task modified), and 4688 (Event: process creation) come from. These are the primary signals for scheduled task detection. Note that 4698, 4699, and 4702 require the Audit Other Object Access Events audit policy to be enabled; without it, these events are not generated regardless of your SIEM configuration.
  • Windows integration: collects Sysmon Operational and PowerShell Operational logs. Sysmon Event 1 (Event: process creation) gives the full command line and parent process. Event 11 (Event: file create) catches payload drops. Events 12 and 13 (Event: registry create/set value) catch TaskCache writes. PowerShell Event 4104 (Event: script block logging) captures the full content of any PowerShell commands used to create or modify tasks.
  • Custom Windows Event Logs: I added the Microsoft-Windows-TaskScheduler/Operational channel also. This log gives Event IDs 106 (Event: task registered), 140 (Event: task updated), 141 (Event: task deleted), 200 (Event: action started), and 201 (Event: action completed). These are lower-level signals that confirm what actually happened at the scheduler level.
  • Custom Logs: pointed at C:\T1053-Lab\Logs\execution.jsonl to pick up the lab payload output. This is the ground truth log that confirms which tasks actually fired and what process ID they ran under.

Enabling Detection rules

In Elastic Security rules, I searched for "scheduled task". There were 13 prebuilt rules available. I enabled all of them.

Figure 13 - All 13 prebuilt scheduled task detection rules enabled in Elastic Security.

The rules that actually fired during the tests were:

  • A scheduled task was created: triggers on Security Event 4698. This is the most straightforward detection because any time a new task is registered through the Task Scheduler API, this rule fires.
  • Temporarily Scheduled Task Creation: an EQL correlation rule that looks for a 4698 followed by a 4699 (Event: task deleted) for the same task name within a short window. This catches the FIN7 pattern of creating a task, running it, and deleting it.
  • Local Scheduled Task Creation: triggers on Sysmon Event 1 (Event: process creation) when schtasks.exe is the process. This catches the process-level signal of task creation via the command line.
  • Unusual Scheduled Task Update: triggers on Security Event 4702 (Event: task modified). This is the only prebuilt rule that catches modification-only patterns like APT41's SCHTASKS /Change.

The other 9 rules (Remote Scheduled Task Creation, Remote Scheduled Task Creation via RPC, Creation or Modification of a new GPO Scheduled Task or Service, Outbound Scheduled Task Activity via PowerShell, Suspicious Execution via Scheduled Task, Persistence via TelemetryController Scheduled Task Hijack, Scheduled Task Created by a Windows Script, UAC Bypass via DiskCleanup Scheduled Task Hijack, Scheduled Task Execution at Scale via GPO) were enabled but did not fire during the RedTeamSimmer or PowerShell script runs. Some of them target specific scenarios (remote creation, GPO-based deployment) that were not part of this lab.

Comparing what ran vs what got detected (RedTeamSimmer Atomic Red Team Tests)

The T1053.005 technique contains 12 Atomic Red Team tests. I ran 8 of them through RedTeamSimmer. And out of those, 7 completed successfully and 1 failed (the VBA test, which needs Microsoft Office). Out of those that completed, 5 generated full telemetry and triggered prebuilt detection rules. The remaining 2 completed without error but did not successfully register a task, so the core detection signals (4698, 106) were never generated.

Figure 14 - Security alerts triggered by RedTeamSimmer T1053.005 emulation in Elastic.

The Elastic prebuilt detection rules fired 16 alerts across 4 rules during the run. Here is the full breakdown per test. Each row maps a RedTeamSimmer Atomic test to what Elastic captured and which prebuilt rules fired.

Test Creation Method 4698 - Security Log (task created) 106 - Task Scheduler Log (task registered) Sysmon 1 (process creation) Sysmon 13 (registry set value) Rules Fired Level
Scheduled Task Startup Script schtasks.exe Yes Yes Yes Yes Task Created, Temp Task, Local Task Logged + Alerted
Scheduled task Local schtasks.exe Yes Yes Yes Yes Task Created, Temp Task Logged + Alerted
Scheduled task Remote schtasks.exe /S No No Yes No Process only Completed (no task created)
PowerShell Cmdlet Scheduled Task Register-ScheduledTask Yes Yes Yes Yes Task Created, Temp Task Logged + Alerted
Task Scheduler via VBA Invoke-MalDoc - - - - - Failed (needs Office)
WMI Invoke-CimMethod CIM method Yes Yes Yes Yes Task Created, Temp Task Logged + Alerted
Base64 Commands From Registry schtasks + reg No No Yes Yes No alert Completed (no task registered)
Import XML Hidden Task CIM + XML Yes Yes Yes Yes Task Created, Temp Task Logged + Alerted
PowerShell Modify A Scheduled Task Set-ScheduledTask Yes + 4702 Yes + 140 Yes Yes Task Created, Temp Task, Unusual Update Logged + Alerted

Table 3 - Full breakdown of each RedTeamSimmer Atomic test showing telemetry coverage and which prebuilt Elastic rules fired.

Not all tests produced detection signals. The Scheduled task Remote test completed but the credentials were invalid for localhost, so the task was never created on the remote host. The Task Scheduler via VBA test failed because Microsoft Office was not installed on the lab system. The Base64 Commands From Registry test completed but schtasks.exe did not successfully register the task, so no 4698 or 106 was generated. These are not detection failures, they are test execution limitations.

Figure 15 - RedTeamSimmer test results summary showing completed and failed Atomic tests.

What stands out is that the tests using schtasks.exe (Scheduled Task Startup Script, Scheduled task Local) and PowerShell cmdlets (PowerShell Cmdlet Scheduled Task) were caught by multiple rules. The WMI Invoke-CimMethod and the Import XML Hidden Task tests were also caught, which is a good sign because those are lower visibility creation methods (see the Task Creation Methods table above). PowerShell Modify A Scheduled Task was run separately and also triggered 3 rules including the "Unusual Scheduled Task Update" rule on the 4702 modification event. The Base64 Commands From Registry test completed but did not register the task.

Figure 16 - Expanded view of the Temporarily Scheduled Task Creation rule showing alert details and investigation context.

Expanding one of the "Temporarily Scheduled Task Creation" alerts shows the investigation context for the emulation test that triggered this rule. The rule type is EQL (Event Query Language), which correlates two events, in this case it is a 4698 (task created) followed by a 4699 (task deleted) for the same task name. The highlighted fields show the host (desktop-g4klo3v), the user (victim), and the source event IDs that triggered the correlation.

Figure 17 - Alert detail from the Atomic ‘Scheduled task Local’ test, showing cmd.exe running SCHTASKS /Create with the full arguments, host and user.

What did the PowerShell script emulations log to Elastic?

The emulate.ps1 script ran six actor emulations (Sandworm was skipped because no remote hosts were configured). Each emulation created tasks using the same method the APT group used, but with harmless payloads that just log the execution metadata. Here is what Elastic saw for each one. Elastic captured 60 task-related events and 8 alerts across 3 rules during the run window.

Figure 18 - Security alerts from the emulate.ps1 APT emulations.

Correlating creation method to detection visibility

In Table 1, I listed the task creation methods with a "Visibility" column. That column was based on documentation alone. But now we can fill it in with what we actually observed after running both the Atomic tests and the PowerShell emulations.

Creation Method 4698 (task created) 4702 (task modified) 106/140 (registered/updated) Sysmon 1 (process creation) Sysmon 13 (registry set value) Prebuilt Rules Confirmed Visibility
schtasks.exe Yes Yes (if /Change) Yes Yes (process + cmdline) Yes 2-3 rules fired High
PowerShell cmdlet Yes Yes (if Set-ScheduledTask) Yes Yes (but no schtasks.exe) Yes 2 rules fired High
WMI / CIM Yes No Yes Yes (provider process) Yes 2 rules fired Medium-High
XML registration Yes No Yes Yes Yes 2 rules fired Medium-High
SCHTASKS /Change (modify only) No (only 4702) Yes Yes (140) Yes Yes 1 rule fired Medium

Table 4 - Confirmed detection visibility per creation method based on lab results.

As we saw in the emulation, any method that goes through the Task Scheduler API generates a 4698 or 4702 event, and it will be caught by the prebuilt rules. The bottom line is that your detection coverage depends on how the attacker creates the task. Most of the groups I covered in this blog use schtasks.exe or PowerShell, which are the noisiest methods and the easiest ones to catch.

The other thing we want to look at is the difference between creating a task and modifying a task. Because as we discussed above, APT41 does not create a new task. They modify an existing legitimate task using SCHTASKS /Change. That means no 4698 event will get generated because nothing new was created. There will be only a 4702 (task modified). And if your detection strategy only looks for 4698 (task created), this APT41 pattern is completely invisible. The RedTeamSimmer APT41 emulation produced a 4702 and got caught by "Unusual Scheduled Task Update", but the "A scheduled task was created" rule never fired for it. So the defenders should keep that in mind when creating rules for detection for techniques like this.

Found an abnormal task? Here is what you should do.

When a suspicious task is discovered, deleting it immediately can destroy useful evidence. So the first objective is to reconstruct the task to see what the task was, when it was created, who created it, what it launched, under which identity it ran, and what behavior followed after it ran. In other words, the investigation starts with the task object, expanding outward into the execution chain, the registry and filesystem artifacts and to the surrounding environment.

Identify the task

Start the investigation by collecting the task's identity and configuration including the name, path, GUID, creation time, modification time, trigger, action, and principal. This information should be gathered from the task definition itself and from the forensic artifacts associated with it, not only from the GUI. A task that appears benign in the Task Scheduler UI may still be malicious if its XML, action, or execution context tells a different story.

Figure 19 - Identifying the scheduled task and its configuration.

Preserve evidence

Before making any cleanup or removal decisions, preserve the evidence that explains the task. This includes the task file under C:\Windows\System32\Tasks\, the relevant registry metadata under TaskCache\Tree and TaskCache\Tasks, the XML definition, security descriptors, process telemetry, command-line data, payload hashes, relevant logon events, and network telemetry. In a live investigation, the goal is to preserve the chain of evidence that makes the task understandable.

Identify the creator account

The next question is who created or modified the task. It can be a legitimate installer, a Microsoft component, PowerShell, schtasks.exe, WMI, a custom binary, remote administration tooling, or GPO. The creator matters because it narrows the intrusion chain and helps distinguish a user-initiated action from a malicious or remote modification.

Figure 20 - Reviewing task creator and execution account details.

This is why the execution account is one of the important questions in the investigation. A task running as a user, administrator, service account, or SYSTEM can have a very different impact. The analyst should determine whether the account is expected for that host and application and whether the task was created in a way that matches the surrounding intrusion activity.

Identify the payload

If the task launches PowerShell, the analyst should look at what command was passed, what script or file it referenced, where it was stored, and what happened immediately after execution began. The real malicious behavior may sit in the interpreted command, in the staged file, or in the next process launched after the task fires.

The task may be only the beginning of the execution path, so the analyst should review the processes that appear after the task fires, including child processes, script interpreters, loader components, network utilities, and final payload launches.

Figure 21 - Following the process chain after scheduled task execution.

Review network activity

At an enterprise level, this step often involves pulling the traffic or proxy logs across multiple segments and correlating them with the task execution timeline from your EDR or SIEM. If task execution is followed by outbound traffic, the relevant data should be correlated with the task timeline. This includes destination information, timestamps, parent process data, payload names or hashes, DNS activity, and repeated connections. A scheduled task that launches a payload and then reaches out to external infrastructure is much more suspicious than one that simply exists in the task list without evidence of follow-on behavior.

Search other hosts

The task investigation becomes broader when the task appears to be remotely created, GPO distributed, ransomware-related, or associated with shared administrative credentials. In these cases, analysts should use their centralized logging to search for the same task name, path, action, payload hash, payload path, or GUID across the environment. The goal is to understand whether this is a single-host event or an enterprise-scale execution mechanism.

Finally, determine the scope of persistence

Finally, determine whether the task is isolated to a single host, tied to a specific user, shared across several systems, or part of a broader GPO or enterprise deployment. This determines the scale of the incident and a task distributed through administrative tooling or policy is very different from a task created by a single user or malware loader on one endpoint.

This is why incident response for scheduled tasks is not just about deleting or removing the malicious object. It requires reconstructing the real execution path, understanding who created the task and why, and deciding how far the same technique may have spread across the environment.

Detection rules for these APT groups

The prebuilt rules caught every test that actually created or changed a task in the lab, but this properties don’t look at what the task launches and they don’t cover patterns of the APT groups we mentioned above. So here are some detection queries I put together from this research to add more coverage. You can drop these into Kibana Discover or turn them into custom detection rules.

Figure 22 - ES|QL filter applied on Elastic Security’s Discover interface that looks for scheduled task creation and modification via schtasks.exe

schtasks.exe with /create or /change

This is the most direct signal. Anytime schtasks.exe runs with a /create or /change flag, that is a task creation or modification event at the process level. Most of the APT groups I covered earlier use this method.

FROM logs-system.security-*, logs-windows.sysmon_operational-*
| WHERE (event.code == "1" OR event.code == "4688")
  AND process.name == "schtasks.exe"
  AND (process.command_line LIKE "*/create*" OR process.command_line LIKE "*/change*")

Script interpreter spawned by the Schedule service

This catches the execution side of the OilRig pattern. After the task fires, the Schedule service (svchost) spawns a script interpreter like wscript, cscript, or PowerShell.

FROM logs-windows.sysmon_operational-*
| WHERE event.code == "1"
  AND process.name IN ("wscript.exe", "cscript.exe", "powershell.exe", "mshta.exe", "rundll32.exe")
  AND process.parent.name == "svchost.exe"
  AND process.parent.command_line LIKE "*Schedule*"

Task modified under \Microsoft\Windows\ (APT41 pattern)

APT41 modified existing Microsoft tasks using SCHTASKS /Change. This query catches 4702 events where a system task was modified by a non-machine account.

FROM logs-system.security-*
| WHERE event.code == "4702"
  AND winlog.event_data.TaskName RLIKE """.*\\Microsoft\\Windows\\.*"""
  AND NOT winlog.event_data.SubjectUserName LIKE """*$"""

Task created and deleted within a short window (FIN7 pattern)

FIN7 creates tasks, runs them, and deletes them within minutes. This ES|QL query finds tasks that were both created and deleted within 10 minutes:

FROM logs-system.security-*
| WHERE event.code IN ("4698", "4699")
| EVAL is_created = CASE(event.code == "4698", 1, 0),
       is_deleted = CASE(event.code == "4699", 1, 0)
| STATS
    created = SUM(is_created),
    deleted = SUM(is_deleted),
    first_seen = MIN(@timestamp),
    last_seen = MAX(@timestamp)
  BY winlog.event_data.TaskName
| WHERE created > 0 AND deleted > 0
| EVAL duration_seconds = DATE_DIFF("seconds", first_seen, last_seen)
| WHERE duration_seconds < 600
| SORT duration_seconds ASC

These queries can be converted into custom Elastic detection rules by going to Security > Rules > Create new rule > ES|QL and pasting them directly.

Conclusion

The most important thing that makes Scheduled Tasks useful to threat actors is the legitimacy within Windows and its functions. A malicious task can look routine, blend into normal operational activity, and still provide persistence or execution under a privileged identity. Across APT groups, malware families, and ransomware operations, the same scheduler can serve very different purposes. An espionage group may use it for persistence, a loader may use it to relaunch a payload, a ransomware operator may use it as the final step after gaining administrative control.

Figure 23 - Threat actors and their use of Windows Scheduled Tasks.

A strong detection strategy for finding malicious scheduled task execution should combine multiple signals and evaluate them as a single pattern. A single suspicious name, a single command-line value, or a single task path is not enough on its own. The stronger signal comes from correlated context. Who created the task, how it was created, what it launched, what security context it used and what happened after it fired.

When it comes to defending, APT emulation and simulation is very important because they allow defenders to move beyond understanding how a technique works and actually test how these techniques can be used against their environment. Testing and reproducing different ways in which APT groups have abused Scheduled Tasks makes it possible to validate the complete execution chain, from task creation or modification, trigger configuration to the execution context, payload, child processes and follow-on activity.

This is where a tool like RedTeamSimmer comes into play. Instead of simply assuming your detections are working as expected, you can validate them directly against your lab environment. Run the RedTeamSimmer agent on the endpoints you want to test, export the results, and compare the generated telemetry with what your SIEM actually captures. I ran 8 Atomic tests for T1053.005 through RedTeamSimmer, easily pulled the output results and compared with Elastic data, and within minutes I had a clear picture of which tests triggered alerts and which ones slipped through the rules.

Don’t assume your prebuilt rules have you fully covered. Some techniques, like APT41’s approach of repointing existing scheduled tasks, rely on a single detection rule, such as Unusual Scheduled Task Update. If an attacker knows what your detection rules look for, those gaps can be easier to exploit. So, run the tests, compare RedTeamSimmer’s ground-truth results with what your SIEM actually detects, and fix the gaps before a real attacker finds them first.

URLs for your reference