· by · 8 min read

A remotely created scheduled task, in 87 milliseconds


schtasks /create /F /tn \Microsoft\Windows\SoftwareProtectionPlatform\EventCacheManager /tr "C:\Windows\system32\cmd.exe /C C:\Windows\System32\notepad.exe" /sc ONSTART /ru system /S WORKSTATION6

That line comes from a real log. It was recorded on December 19, 2020 in the OTRF Security-Datasets lab, a project that publishes Windows logs from documented attack simulations under the MIT licence. The dataset is called schtask_create, and it has everything needed for an exercise I find more useful than any tutorial: following one single action end to end, across both machines it touches.

The payload is harmless (Notepad at boot). What matters is the shape.

What the command does

Taking it apart with the schtasks create documentation:

  • /S WORKSTATION6: the task is created on another machine. The docs note that only administrators can schedule tasks, so doing it remotely means admin rights on the target.
  • /ru system: it will run as SYSTEM.
  • /sc ONSTART: at every boot. That’s persistence.
  • /tn \Microsoft\Windows\SoftwareProtectionPlatform\EventCacheManager: the name sits inside Windows’ own task tree, next to genuine system tasks. That’s the interesting bit, and I’ll come back to it.

87 milliseconds, two hosts

I pulled every event tied to this task out of the dataset, along with the host that logged it. Here’s the whole chain:

Two-column timeline. On WORKSTATION5, the source: Sysmon 1 at 0 ms (cmd.exe /C schtasks /create, parent powershell.exe), Security 4688 at 13 ms (schtasks.exe /create /tn \Microsoft\Windows\… /S WORKSTATION6), Sysmon 1 at 14 ms (schtasks.exe). On WORKSTATION6, the target: Security 4624 at 61 ms (logon type 3, Kerberos, pgustavo), Sysmon 12/13 at 69 ms (TaskCache keys written by svchost.exe), Sysmon 11 at 71 ms (file in C:\Windows\System32\Tasks), Security 4698 at 87 ms (task created).
The task creation as seen by both hosts’ logs. Diagram: PurpleLog, data from OTRF Security-Datasets (schtask_create).

The source, WORKSTATION5, only sees processes: PowerShell starts cmd.exe, which starts schtasks.exe with the full command line. That’s the one and only place you see /S and the target’s name.

The target, WORKSTATION6, never sees schtasks.exe at all. It sees a Kerberos network logon for pgustavo (a type 3 4624, dissected in the logon types post), then the Task Scheduler service, hosted in svchost.exe, writing its registry keys under TaskCache, dropping the task’s XML file into C:\Windows\System32\Tasks\, and raising event 4698.

One caveat on the timings: these are timestamps from two different machines, so two clocks. The ordering holds up; I wouldn’t swear to every millisecond.

The lesson here is simple and easy to lose inside a SIEM. One attacker action leaves traces on two hosts, and neither tells the whole story. The source tells you who ran what against where. The target tells you what got installed and under which account it arrived.

4698, the richest event in the chain

4698 depends on the “Audit Other Object Access Events” subcategory, per its documentation. No subcategory, no event. When it is there, it carries the task’s full XML. Here are the important bits from the dataset:

<RegistrationInfo>
  <Date>2020-12-19T07:00:22</Date>
  <Author>THESHIRE\pgustavo</Author>
  <URI>\Microsoft\Windows\SoftwareProtectionPlatform\EventCacheManager</URI>
</RegistrationInfo>
<Triggers>
  <BootTrigger>
    <Enabled>true</Enabled>
  </BootTrigger>
</Triggers>
<Actions Context="Author">
  <Exec>
    <Command>C:\Windows\system32\cmd.exe</Command>
    <Arguments>/C C:\Windows\System32\notepad.exe</Arguments>
  </Exec>
</Actions>
<Principals>
  <Principal id="Author">
    <UserId>S-1-5-18</UserId>
  </Principal>
</Principals>

It’s all there: a human author (THESHIRE\pgustavo), a boot trigger, a command routed through cmd.exe, and principal S-1-5-18, which is SYSTEM. A user creating a task that runs as SYSTEM at every boot is, on its own, worth stopping for in triage.

A side note: since Windows 10 1903, Microsoft added fields such as ClientProcessId, ParentProcessId and RpcCallClientLocality to 4698. Here all three are 0. The docs don’t explain them, but that fits a creation that came from another host, with no local client process.

What if there’s no 4698?

On plenty of networks there isn’t, since the subcategory has to be switched on. The dataset shows a handy safety net: the registry.

Within the same second, Sysmon logged the Task Scheduler writing keys under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\. A Tree subkey carries the task name. A Tasks\{GUID} subkey holds its metadata, including an Author value that reads, in plain text, THESHIRE\pgustavo.

So even without 4698 you still get the task name, its author and its date. Not the command, though: Actions is stored as binary and Sysmon just writes “Binary Data”. For that, you’re left with the XML file created under C:\Windows\System32\Tasks\, which Sysmon event 11 flags without showing its content. Someone has to go and read it on the host.

Less comfortable than a full 4698. Still plenty for a rule on those registry keys to raise its hand.

Why “the root folder” isn’t enough

The same documentation gives a monitoring tip you’ll see repeated everywhere: watch new tasks created in the root of the Task Scheduler Library (a name like \TaskName), because manually created and malicious tasks often land there.

True. And it’s exactly what the task in this dataset avoids by tucking itself under \Microsoft\Windows\, among the system tasks. That’s ATT&CK T1036.004, masquerading a task or service.

I wanted to see how both approaches behave on real data. Across the 29 OTRF datasets I downloaded (the lateral_movement/host folder) there are exactly three 4698 events:

Output of replay_st.py over the three 4698 events in the 29 OTRF datasets. Two “OneDrive Standalone Update Task” tasks created in the root by accounts sbeavers and wardog: the root heuristic alerts, the PurpleLog rule doesn’t. The \Microsoft\Windows\SoftwareProtectionPlatform\EventCacheManager task created by pgustavo: the root heuristic stays quiet, the PurpleLog rule alerts.
Three tasks, two approaches: the root heuristic fires on both legitimate tasks and misses the only malicious one. Real output, capture: PurpleLog.

The two root-level tasks are OneDrive updaters, entirely legitimate, created on behalf of the user. The disguised task is the only one the heuristic misses. Three events is a tiny sample and I won’t pull a statistic out of it. It does show the problem nicely: any path-based criterion can be dodged by picking a different path.

Two rules, one per host

Since the action leaves traces at both ends, I wrote one rule for each end.

On the target: a task filed under \Microsoft\Windows\ but requested by an account that isn’t a machine account. Real system tasks are created by the system; a named account dropping one there is usually trying to blend in.

title: Scheduled Task Created Under \Microsoft\Windows\ By a User Account
id: 9b388db9-5797-4cd2-880f-2d1e1cf8d420
status: experimental
description: |
  Detects a 4698 event for a task filed under \Microsoft\Windows\ when the requesting
  account isn't a machine account. System tasks are created by the system; a user adding
  one in that location is often trying to blend in.
references:
  - https://learn.microsoft.com/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4698
  - https://attack.mitre.org/techniques/T1053/005/
author: PurpleLog
date: 2026-11-03
tags:
  - attack.persistence
  - attack.t1053.005
  - attack.stealth
  - attack.t1036.004
logsource:
  product: windows
  service: security
  definition: 'Requires the "Audit Other Object Access Events" audit subcategory'
detection:
  selection:
    EventID: 4698
    TaskName|startswith: '\Microsoft\Windows\'
  filter_machine:
    SubjectUserName|endswith: '$'
  condition: selection and not filter_machine
falsepositives:
  - Third-party software or admin scripts that file their tasks under \Microsoft\Windows\ using a named account
level: high

On the source: schtasks.exe with both /create and /s, i.e. creating a task on another machine.

title: Scheduled Task Created On a Remote Host With schtasks
id: 73d8275a-3f31-4f00-a95f-d62752bed4e3
status: experimental
description: Detects schtasks.exe run with /create and /S, i.e. creating a task on another machine.
references:
  - https://learn.microsoft.com/windows-server/administration/windows-commands/schtasks-create
  - https://attack.mitre.org/techniques/T1053/005/
author: PurpleLog
date: 2026-11-03
tags:
  - attack.execution
  - attack.t1053.005
logsource:
  category: process_creation
  product: windows
detection:
  selection_img:
    - Image|endswith: '\schtasks.exe'
    - OriginalFileName: 'schtasks.exe'
  selection_cli:
    CommandLine|contains|all:
      - ' /create'
      - ' /s '
  condition: all of selection_*
falsepositives:
  - Admin tooling that deploys tasks remotely
level: medium

Both pass sigma check with no errors or warnings, with ATT&CK tags checked against version 20. Replayed over the 29 OTRF datasets, the first catches the disguised task and nothing else; the second catches the remote creation and nothing else. It sees it in the Sysmon 1 event. The matching 4688 only triggers it if your SIEM maps that event’s NewProcessName field onto the process_creation category’s Image field. A raw execution of the rule, without that mapping, doesn’t see it. One limitation I’ll own on the second: ' /s ' expects a space after the switch. A command line ending exactly in /s would slip past, but schtasks needs a host name after it anyway.

What I’d check first

If the target-side rule fires, I go back to the ten-minute triage routine with three specific questions. Is the task’s author an expected admin on that host? Does the preceding type 3 4624 come from a known admin workstation? And what does the task actually run? cmd.exe or powershell.exe as SYSTEM at boot is rarely an office app.

If the source-side rule fires, I look at the list of targets. An admin creating a task on a server from their admin workstation is doing their job. The same thing on ten laptops in two minutes from a user’s machine is lateral movement.

References

How I check the rules and queries published here →