Detection rules › Elastic

Local Scheduled Task Creation

Status
production
Severity
low
Time window
1m
Sequence by
process.entity_id, process.parent.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

Indicates the creation of a scheduled task. Adversaries can use these to establish persistence, move laterally, and/or escalate privileges.

Known false positives

  • Legitimate scheduled tasks may be created during installation of new software.

MITRE ATT&CK coverage

Telemetry coverage

Rule body

[metadata]
creation_date = "2020/02/18"
integration = ["endpoint", "windows"]
maturity = "production"
updated_date = "2026/08/03"

[rule]
author = ["Elastic"]
description = """
Indicates the creation of a scheduled task. Adversaries can use these to establish persistence, move laterally, and/or
escalate privileges.
"""
false_positives = ["Legitimate scheduled tasks may be created during installation of new software."]
from = "now-9m"
index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.sysmon_operational-*"]
language = "eql"
license = "Elastic License v2"
name = "Local Scheduled Task Creation"
note = """## Triage and analysis

> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

### Investigating Local Scheduled Task Creation

Scheduled tasks in Windows automate routine tasks, but adversaries exploit them for persistence, lateral movement, or privilege escalation. They may use command-line tools like `schtasks.exe` to create tasks under non-system accounts. The detection rule identifies suspicious task creation by monitoring specific processes and command-line arguments, excluding those initiated by system-level users, to flag potential misuse.

### Possible investigation steps

- Review the process entity ID to identify the parent process that initiated the scheduled task creation. This can provide context on whether the task was created by a legitimate application or a potentially malicious one.
- Examine the command-line arguments used with schtasks.exe, specifically looking for unusual or suspicious parameters that might indicate malicious intent, such as unexpected task names or execution paths.
- Check the user account associated with the task creation to determine if it is a non-system account and assess whether this account should have the capability to create scheduled tasks.
- Investigate the integrity level of the process to confirm it is not running with elevated privileges, which could indicate an attempt to bypass security controls.
- Correlate the event with other recent activities on the host, such as file modifications or network connections, to identify any patterns or additional indicators of compromise.
- Review the code signature of the initiating process to determine if it is trusted or untrusted, which can help assess the legitimacy of the process creating the task.

### False positive analysis

- Scheduled tasks created by legitimate administrative tools or scripts may trigger false positives. Users should identify and whitelist these known benign processes to prevent unnecessary alerts.
- Routine maintenance tasks initiated by IT departments, such as software updates or system checks, can be mistaken for suspicious activity. Exclude these tasks by specifying their unique process names or command-line arguments.
- Tasks created by trusted third-party applications for legitimate purposes might be flagged. Review and exclude these applications by verifying their code signatures and adding them to an exception list.
- Automated tasks set up by non-system accounts for regular operations, like backups or monitoring, can be misinterpreted. Document these tasks and exclude them based on their specific parameters or user accounts involved.
- Consider excluding tasks with a consistent and verified schedule that aligns with organizational policies, as these are less likely to be malicious.

### Response and remediation

- Immediately isolate the affected system from the network to prevent potential lateral movement by the adversary.
- Terminate any suspicious scheduled tasks identified by the alert using Task Scheduler or command-line tools like schtasks.exe to stop further execution.
- Review and remove any unauthorized scheduled tasks created by non-system accounts to eliminate persistence mechanisms.
- Conduct a thorough scan of the affected system using updated antivirus or endpoint detection and response (EDR) tools to identify and remove any additional malicious artifacts.
- Analyze the user account involved in the task creation for signs of compromise, and reset credentials if necessary to prevent further unauthorized access.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Implement enhanced monitoring and logging for scheduled task creation events to detect similar threats in the future, ensuring alerts are configured to notify the appropriate teams promptly."""
references = [
    "https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-1",
    "https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-2",
    "https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine",
    "https://www.elastic.co/security-labs/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper",
]
risk_score = 21
rule_id = "afcce5ad-65de-4ed2-8516-5e093d3ac99a"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Resources: Investigation Guide",
]
type = "eql"

query = '''
sequence with maxspan=1m
  [process where host.os.type == "windows" and event.type == "start" and
    ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
                      "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or
    process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
                                     "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe",
                                     "winrshost.exe")) or
    ?process.code_signature.trusted == false) and
    /* exclude legitimate software creating its own scheduled tasks */
    not (
      process.name : "cmd.exe" and
      (
        (
          process.parent.executable : "?:\\Program Files\\Adobe\\Adobe Creative Cloud Experience\\libs\\node.exe" and
          process.command_line : "*?:\\Program Files\\Adobe\\Adobe Creative Cloud Experience\\CCXProcess.exe*"
        ) or
        (
          process.parent.executable : "?:\\Program Files (x86)\\LG Software\\LG App Count\\LGAppCountObserver.exe" and
          process.command_line : "*?:\\Program Files (x86)\\LG Software\\LG App Count\\*"
        ) or
        (
          process.parent.executable : "?:\\Program Files (x86)\\LG Software\\LG Update & Recovery\\URAlarm.exe" and
          process.command_line : "*?:\\Program Files (x86)\\LG Software\\LG Update & Recovery\\Support\\*"
        )
      )
    )
  ] by process.entity_id
  [process where host.os.type == "windows" and event.type == "start" and
    (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and
    process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and
    /* exclude SYSTEM Integrity Level - look for task creations by non-SYSTEM user */
    not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
  ] by process.parent.entity_id
'''

setup = """## Setup

This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.

Setup instructions: https://ela.st/install-elastic-defend

### Additional data sources

This rule also supports the following third-party data sources. For setup instructions, refer to the links below:

- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
"""


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[rule.threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"



[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.

Stage 1: process

[process where host.os.type == "windows" and event.type == "start" and
    ((process.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
                      "powershell.exe", "pwsh.exe", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe", "winrshost.exe") or
    process.pe.original_file_name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe", "wmic.exe", "mshta.exe",
                                     "powershell.exe", "pwsh.dll", "powershell_ise.exe", "WmiPrvSe.exe", "wsmprovhost.exe",
                                     "winrshost.exe")) or
    ?process.code_signature.trusted == false) and
    not (
      process.name : "cmd.exe" and
      (
        (
          process.parent.executable : "?:\\Program Files\\Adobe\\Adobe Creative Cloud Experience\\libs\\node.exe" and
          process.command_line : "*?:\\Program Files\\Adobe\\Adobe Creative Cloud Experience\\CCXProcess.exe*"
        ) or
        (
          process.parent.executable : "?:\\Program Files (x86)\\LG Software\\LG App Count\\LGAppCountObserver.exe" and
          process.command_line : "*?:\\Program Files (x86)\\LG Software\\LG App Count\\*"
        ) or
        (
          process.parent.executable : "?:\\Program Files (x86)\\LG Software\\LG Update & Recovery\\URAlarm.exe" and
          process.command_line : "*?:\\Program Files (x86)\\LG Software\\LG Update & Recovery\\Support\\*"
        )
      )
    )
  ] by process.entity_id

Stage 2: process

[process where host.os.type == "windows" and event.type == "start" and
    (process.name : "schtasks.exe" or process.pe.original_file_name == "schtasks.exe") and
    process.args : ("/create", "-create") and process.args : ("/RU", "/SC", "/TN", "/TR", "/F", "/XML") and
    not (?process.Ext.token.integrity_level_name : "System" or ?winlog.event_data.IntegrityLevel : "System")
  ] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.command_linematch?:\Program Files (x86)\LG Software\LG App Count\excludes:process.command_line field:"process.command_line" value:"?:\Program Files (x86)\LG Software\LG App Count\"
process.parent.executableeq?:\Program Files (x86)\LG Software\LG App Count\LGAppCountObserver.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\LG Software\LG App Count\LGAppCountObserver.exe"
process.command_linematch?:\Program Files (x86)\LG Software\LG Update & Recovery\Support\excludes:process.command_line field:"process.command_line" value:"?:\Program Files (x86)\LG Software\LG Update & Recovery\Support\"
process.parent.executableeq?:\Program Files (x86)\LG Software\LG Update & Recovery\URAlarm.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\LG Software\LG Update & Recovery\URAlarm.exe"
process.command_linematch?:\Program Files\Adobe\Adobe Creative Cloud Experience\CCXProcess.exeexcludes:process.command_line field:"process.command_line" value:"?:\Program Files\Adobe\Adobe Creative Cloud Experience\CCXProcess.exe"
process.parent.executableeq?:\Program Files\Adobe\Adobe Creative Cloud Experience\libs\node.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files\Adobe\Adobe Creative Cloud Experience\libs\node.exe"
process.nameeqcmd.exeexcludes:process.name field:"process.name" value:"cmd.exe"
process.Ext.token.integrity_level_nameeqSystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"System"
winlog.event_data.IntegrityLeveleqSystemexcludes:winlog.event_data.IntegrityLevel field:"winlog.event_data.IntegrityLevel" value:"System"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start corpus 1078 (elastic 1078)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • -create corpus 6 (elastic 6)
  • /F corpus 5 (elastic 5)
  • /RU corpus 2 (elastic 2)
  • /SC
  • /TN
  • /TR corpus 4 (elastic 4)
  • /XML corpus 2 (elastic 2)
  • /create corpus 7 (elastic 7)
field:"process.args" kind:wildcard
process.code_signature.trustedeq
  • false transforms: boolean corpus 115 (elastic 115)
field:"process.code_signature.trusted" kind:eq value:"false"
process.namewildcard
  • WmiPrvSe.exe corpus 7 (elastic 7)
  • cmd.exe corpus 121 (elastic 92, splunk 29)
  • mshta.exe corpus 84 (elastic 79, splunk 5)
  • powershell.exe corpus 184 (elastic 140, splunk 44)
  • powershell_ise.exe corpus 52 (splunk 29, elastic 23)
  • pwsh.exe corpus 77 (elastic 48, splunk 29)
  • regsvr32.exe corpus 73 (elastic 68, splunk 5)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
  • schtasks.exe corpus 30 (elastic 19, splunk 11)
  • winrshost.exe corpus 4 (elastic 4)
  • wmic.exe corpus 66 (elastic 39, splunk 27)
  • wscript.exe corpus 83 (elastic 82, splunk 1)
  • wsmprovhost.exe corpus 4 (elastic 4)
field:"process_name" kind:wildcard
process.pe.original_file_nameeq
  • schtasks.exe corpus 31 (sigma 18, elastic 9, splunk 4)
field:"OriginalFileName" kind:eq value:"schtasks.exe"
process.pe.original_file_namewildcard
  • WmiPrvSe.exe
  • cmd.exe corpus 81 (sigma 43, elastic 21, splunk 17)
  • mshta.exe corpus 40 (elastic 21, sigma 13, splunk 6)
  • powershell.exe corpus 138 (sigma 84, splunk 30, elastic 24)
  • powershell_ise.exe corpus 51 (splunk 30, sigma 18, elastic 3)
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)
  • regsvr32.exe corpus 37 (sigma 17, elastic 15, splunk 5)
  • rundll32.exe corpus 78 (sigma 35, elastic 22, splunk 21)
  • winrshost.exe
  • wmic.exe corpus 80 (sigma 38, elastic 24, splunk 18)
  • wscript.exe corpus 38 (elastic 21, sigma 17)
  • wsmprovhost.exe
field:"OriginalFileName" kind:wildcard