Detection rules › Splunk

WinEvent Scheduled Task Created Within Public Path

Status
production
Severity
medium
Group by
TaskContent, computer_name, task_name, user
Author
Michael Haag, Splunk
Source
github.com/splunk/security_content

The following analytic detects the creation of scheduled tasks within user-writable paths using Windows Security EventCode 4698. It identifies tasks registered via schtasks.exe or TaskService that execute commands from directories like Public, ProgramData, Temp, and AppData. This behavior is significant as it may indicate an attempt to establish persistence or execute unauthorized commands. If confirmed malicious, an attacker could maintain long-term access, escalate privileges, or execute arbitrary code, posing a severe threat to system integrity and security.

Known false positives

  • False positives are possible if legitimate applications are allowed to register tasks in public paths. Filter as needed based on paths that are used legitimately.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

name: WinEvent Scheduled Task Created Within Public Path
id: 5d9c6eee-988c-11eb-8253-acde48001122
version: 25
creation_date: '2021-04-08'
modification_date: '2026-05-13'
author: Michael Haag, Splunk
status: production
type: TTP
description: The following analytic detects the creation of scheduled tasks within user-writable paths using Windows Security EventCode 4698. It identifies tasks registered via schtasks.exe or TaskService that execute commands from directories like Public, ProgramData, Temp, and AppData. This behavior is significant as it may indicate an attempt to establish persistence or execute unauthorized commands. If confirmed malicious, an attacker could maintain long-term access, escalate privileges, or execute arbitrary code, posing a severe threat to system integrity and security.
data_source:
    - Windows Event Log Security 4698
search: |
    `wineventlog_security`
    EventCode=4698
    TaskContent IN (
      "*\\users\\public\\*", "*\\programdata\\*", "*\\temp\\*",
      "*\\Windows\\Tasks\\*", "*\\appdata\\*", "*\\perflogs\\*"
      )
    | stats count min(_time) as firstTime max(_time) as lastTime
      by Computer, TaskName, TaskContent, user
    |  rename Computer as dest
    | `security_content_ctime(firstTime)`
    | `security_content_ctime(lastTime)`
    | `winevent_scheduled_task_created_within_public_path_filter`
how_to_implement: To successfully implement this search, you need to be ingesting Windows Security Event Logs with 4698 EventCode enabled. The Windows TA is also required.
known_false_positives: False positives are possible if legitimate applications are allowed to register tasks in public paths. Filter as needed based on paths that are used legitimately.
references:
    - https://research.checkpoint.com/2021/irans-apt34-returns-with-an-updated-arsenal/
    - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventID=4698
    - https://redcanary.com/threat-detection-report/techniques/scheduled-task-job/
    - https://docs.microsoft.com/en-us/windows/win32/taskschd/time-trigger-example--scripting-?redirectedfrom=MSDN
    - https://app.any.run/tasks/e26f1b2e-befa-483b-91d2-e18636e2faf3/
finding:
    title: A windows scheduled task was created (task name=$TaskName$) on $dest$
    entity:
        field: dest
        type: system
        score: 50
analytic_story:
    - Data Destruction
    - Winter Vivern
    - Industroyer2
    - Compromised Windows Host
    - Quasar RAT
    - China-Nexus Threat Activity
    - XWorm
    - Ransomware
    - IcedID
    - CISA AA23-347A
    - Salt Typhoon
    - Ryuk Ransomware
    - Active Directory Lateral Movement
    - Malicious Inno Setup Loader
    - CISA AA22-257A
    - Medusa Ransomware
    - SystemBC
    - Scheduled Tasks
    - Prestige Ransomware
    - AsyncRAT
    - Windows Persistence Techniques
    - 0bj3ctivity Stealer
    - APT37 Rustonotto and FadeStealer
    - Castle RAT
    - ValleyRAT
    - PlugX
    - Remcos
asset_type: Endpoint
mitre_attack_id:
    - T1053.005
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint

Stages and Predicates

Stage 1: search

`wineventlog_security`
EventCode=4698
TaskContent IN (
  "*\\users\\public\\*", "*\\programdata\\*", "*\\temp\\*",
  "*\\Windows\\Tasks\\*", "*\\appdata\\*", "*\\perflogs\\*"
  )

Stage 2: stats

| stats count min(_time) as firstTime max(_time) as lastTime
  by Computer, TaskName, TaskContent, user

Stage 3: rename

| rename Computer as dest

Stage 4: search

| `security_content_ctime(firstTime)`

Stage 5: search

| `security_content_ctime(lastTime)`

Stage 6: search

| `winevent_scheduled_task_created_within_public_path_filter`

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
EventCodeeq
  • 4698 corpus 13 (splunk 13)
field:"EventID" kind:eq value:"4698"
TaskContentin
  • "*\\Windows\\Tasks\\*"
  • "*\\appdata\\*"
  • "*\\perflogs\\*"
  • "*\\programdata\\*"
  • "*\\temp\\*"
  • "*\\users\\public\\*"
field:"TaskContent" kind:in