Detection rules › Sigma

Schedule Task Creation From Env Variable Or Potentially Suspicious Path Via Schtasks.EXE

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Florian Roth (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects Schtask creations that point to a suspicious folder or an environment variable often used by malware

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Schedule Task Creation From Env Variable Or Potentially Suspicious Path Via Schtasks.EXE
id: 81325ce1-be01-4250-944f-b4789644556f
related:
    - id: 43f487f0-755f-4c2a-bce7-d6d2eec2fcf8 # TODO: Recreate after baseline
      type: derived
status: test
description: Detects Schtask creations that point to a suspicious folder or an environment variable often used by malware
references:
    - https://www.welivesecurity.com/2022/01/18/donot-go-do-not-respawn/
    - https://www.joesandbox.com/analysis/514608/0/html#324415FF7D8324231381BAD48A052F85DF04
    - https://blog.talosintelligence.com/gophish-powerrat-dcrat/
author: Florian Roth (Nextron Systems)
date: 2022-02-21
modified: 2025-10-07
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.execution
    - attack.t1053.005
logsource:
    product: windows
    category: process_creation
detection:
    selection_1_create:
        Image|endswith: '\schtasks.exe'
        CommandLine|contains|windash: ' /create '
    selection_1_all_folders:
        CommandLine|contains:
            - ':\Perflogs'
            - ':\Users\All Users\'
            - ':\Users\Default\'
            - ':\Users\Public'
            - ':\Windows\Temp'
            - '\AppData\Local\'
            - '\AppData\Roaming\'
            - '%AppData%'
            - '%Public%'
    selection_2_parent:
        ParentCommandLine|endswith: '\svchost.exe -k netsvcs -p -s Schedule'
    selection_2_some_folders:
        CommandLine|contains:
            - ':\Perflogs'
            - ':\Windows\Temp'
            - '\Users\Public'
            - '%Public%'
    filter_optional_other:
        - ParentCommandLine|contains: 'unattended.ini'
        - CommandLine|contains: 'update_task.xml'
    filter_optional_team_viewer:
        CommandLine|contains: '/Create /TN TVInstallRestore /TR'
    filter_optional_avira_install:
        # Comment out this filter if you dont use AVIRA
        CommandLine|contains|all:
            - '/Create /Xml '
            - '\Temp\.CR.'
            - '\Avira_Security_Installation.xml'
    filter_optional_avira_other:
        # Comment out this filter if you dont use AVIRA
        CommandLine|contains|all:
            - '/Create /F /TN'
            - '/Xml '
            - '\Temp\'
            - 'Avira_'
        CommandLine|contains:
            - '.tmp\UpdateFallbackTask.xml'
            - '.tmp\WatchdogServiceControlManagerTimeout.xml'
            - '.tmp\SystrayAutostart.xml'
            - '.tmp\MaintenanceTask.xml'
    filter_optional_klite_codec:
        CommandLine|contains|all:
            - '\Temp\'
            - '/Create /TN "klcp_update" /XML '
            - '\klcp_update_task.xml'
    condition: ( all of selection_1_* or all of selection_2_* ) and not 1 of filter_optional_*
falsepositives:
    - Benign scheduled tasks creations or executions that happen often during software installations
    - Software that uses the AppData folder and scheduled tasks to update the software in the AppData folders
level: medium

Stages and Predicates

Stage 0: condition

( all of selection_1_* or all of selection_2_* ) and not 1 of filter_optional_*

Stage 1: selection_1_create

selection_1_create:
    Image|endswith: '\schtasks.exe'
    CommandLine|contains|windash: ' /create '

Stage 2: selection_1_all_folders

selection_1_all_folders:
    CommandLine|contains:
        - ':\Perflogs'
        - ':\Users\All Users\'
        - ':\Users\Default\'
        - ':\Users\Public'
        - ':\Windows\Temp'
        - '\AppData\Local\'
        - '\AppData\Roaming\'
        - '%AppData%'
        - '%Public%'

Stage 3: selection_2_parent

selection_2_parent:
    ParentCommandLine|endswith: '\svchost.exe -k netsvcs -p -s Schedule'

Stage 4: selection_2_some_folders

selection_2_some_folders:
    CommandLine|contains:
        - ':\Perflogs'
        - ':\Windows\Temp'
        - '\Users\Public'
        - '%Public%'

Stage 5: not filter_optional_*

filter_optional_other:
    - ParentCommandLine|contains: 'unattended.ini'
    - CommandLine|contains: 'update_task.xml'
filter_optional_team_viewer:
    CommandLine|contains: '/Create /TN TVInstallRestore /TR'
filter_optional_avira_install:
    CommandLine|contains|all:
        - '/Create /Xml '
        - '\Temp\.CR.'
        - '\Avira_Security_Installation.xml'
filter_optional_avira_other:
    CommandLine|contains|all:
        - '/Create /F /TN'
        - '/Xml '
        - '\Temp\'
        - 'Avira_'
    CommandLine|contains:
        - '.tmp\UpdateFallbackTask.xml'
        - '.tmp\WatchdogServiceControlManagerTimeout.xml'
        - '.tmp\SystrayAutostart.xml'
        - '.tmp\MaintenanceTask.xml'
filter_optional_klite_codec:
    CommandLine|contains|all:
        - '\Temp\'
        - '/Create /TN "klcp_update" /XML '
        - '\klcp_update_task.xml'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
CommandLinematch.tmp\MaintenanceTask.xml
CommandLinematch.tmp\SystrayAutostart.xml
CommandLinematch.tmp\UpdateFallbackTask.xml
CommandLinematch.tmp\WatchdogServiceControlManagerTimeout.xml
CommandLinematch/Create /F /TN
CommandLinematch/Xml
CommandLinematchAvira_
CommandLinematch\Temp\
CommandLinematch/Create /TN "klcp_update" /XML
CommandLinematch\Temp\
CommandLinematch\klcp_update_task.xml
CommandLinematch/Create /Xml
CommandLinematch\Avira_Security_Installation.xml
CommandLinematch\Temp\.CR.
CommandLinematch/Create /TN TVInstallRestore /TR
CommandLinematchupdate_task.xml
ParentCommandLinematchunattended.ini

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • /create transforms: windash corpus 15 (sigma 15)
  • %AppData% corpus 13 (sigma 11, chronicle 2)
  • %Public% corpus 7 (sigma 5, chronicle 2)
  • :\Perflogs corpus 3 (sigma 3)
  • :\Users\All Users\
  • :\Users\Default\ corpus 3 (sigma 3)
  • :\Users\Public corpus 2 (sigma 2)
  • :\Windows\Temp corpus 2 (sigma 2)
  • \AppData\Local\ corpus 10 (sigma 10)
  • \AppData\Roaming\ corpus 16 (sigma 16)
  • \Users\Public
Imageends_with
  • \schtasks.exe corpus 56 (sigma 56)
ParentCommandLineends_with
  • \svchost.exe -k netsvcs -p -s Schedule