Detection rules › Sigma

Suspicious Modification Of Scheduled Tasks

Status
test
Severity
high
Log source
product windows, category process_creation
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects when an attacker tries to modify an already existing scheduled tasks to run from a suspicious location Attackers can create a simple looking task in order to avoid detection on creation as it's often the most focused on Instead they modify the task after creation to include their malicious payload

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Suspicious Modification Of Scheduled Tasks
id: 1c0e41cd-21bb-4433-9acc-4a2cd6367b9b
related:
    - id: 614cf376-6651-47c4-9dcc-6b9527f749f4 # Security-Audting Eventlog
      type: similar
status: test
description: |
    Detects when an attacker tries to modify an already existing scheduled tasks to run from a suspicious location
    Attackers can create a simple looking task in order to avoid detection on creation as it's often the most focused on
    Instead they modify the task after creation to include their malicious payload
references:
    - Internal Research
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-07-28
modified: 2022-11-18
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.execution
    - attack.t1053.005
logsource:
    product: windows
    category: process_creation
detection:
    selection_schtasks:
        Image|endswith: '\schtasks.exe'
        CommandLine|contains|all:
            - ' /Change '
            - ' /TN '
    selection_susp_locations:
        CommandLine|contains:
            - '\AppData\Local\Temp'
            - '\AppData\Roaming\'
            - '\Users\Public\'
            - '\WINDOWS\Temp\'
            - '\Desktop\'
            - '\Downloads\'
            - '\Temporary Internet'
            - 'C:\ProgramData\'
            - 'C:\Perflogs\'
            - '%ProgramData%'
            - '%appdata%'
            - '%comspec%'
            - '%localappdata%'
    selection_susp_images:
        CommandLine|contains:
            - 'regsvr32'
            - 'rundll32'
            - 'cmd /c '
            - 'cmd /k '
            - 'cmd /r '
            - 'cmd.exe /c '
            - 'cmd.exe /k '
            - 'cmd.exe /r '
            - 'powershell'
            - 'mshta'
            - 'wscript'
            - 'cscript'
            - 'certutil'
            - 'bitsadmin'
            - 'bash.exe'
            - 'bash '
            - 'scrcons'
            - 'wmic '
            - 'wmic.exe'
            - 'forfiles'
            - 'scriptrunner'
            - 'hh.exe'
            - 'hh '
    condition: all of selection_*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_schtasks

selection_schtasks:
    Image|endswith: '\schtasks.exe'
    CommandLine|contains|all:
        - ' /Change '
        - ' /TN '

Stage 2: selection_susp_locations

selection_susp_locations:
    CommandLine|contains:
        - '\AppData\Local\Temp'
        - '\AppData\Roaming\'
        - '\Users\Public\'
        - '\WINDOWS\Temp\'
        - '\Desktop\'
        - '\Downloads\'
        - '\Temporary Internet'
        - 'C:\ProgramData\'
        - 'C:\Perflogs\'
        - '%ProgramData%'
        - '%appdata%'
        - '%comspec%'
        - '%localappdata%'

Stage 3: selection_susp_images

selection_susp_images:
    CommandLine|contains:
        - 'regsvr32'
        - 'rundll32'
        - 'cmd /c '
        - 'cmd /k '
        - 'cmd /r '
        - 'cmd.exe /c '
        - 'cmd.exe /k '
        - 'cmd.exe /r '
        - 'powershell'
        - 'mshta'
        - 'wscript'
        - 'cscript'
        - 'certutil'
        - 'bitsadmin'
        - 'bash.exe'
        - 'bash '
        - 'scrcons'
        - 'wmic '
        - 'wmic.exe'
        - 'forfiles'
        - 'scriptrunner'
        - 'hh.exe'
        - 'hh '

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
  • /Change corpus 3 (sigma 3)
  • /TN corpus 2 (sigma 2)
  • %ProgramData% corpus 4 (sigma 4)
  • %appdata% corpus 13 (sigma 11, chronicle 2)
  • %comspec% corpus 6 (sigma 5, splunk 1)
  • %localappdata% corpus 4 (sigma 4)
  • C:\Perflogs\ corpus 2 (sigma 2)
  • C:\ProgramData\ corpus 6 (sigma 6)
  • \AppData\Local\Temp corpus 8 (sigma 8)
  • \AppData\Roaming\ corpus 16 (sigma 16)
  • \Desktop\ corpus 13 (sigma 13)
  • \Downloads\ corpus 14 (sigma 14)
  • \Temporary Internet corpus 7 (sigma 7)
  • \Users\Public\ corpus 17 (sigma 17)
  • \WINDOWS\Temp\ corpus 12 (sigma 12)
  • bash
  • bash.exe
  • bitsadmin corpus 10 (sigma 10)
  • certutil corpus 12 (sigma 10, kusto 2)
  • cmd /c corpus 4 (sigma 4)
  • cmd /k corpus 4 (sigma 4)
  • cmd /r corpus 4 (sigma 4)
  • cmd.exe /c corpus 6 (sigma 6)
  • cmd.exe /k corpus 5 (sigma 5)
  • cmd.exe /r corpus 5 (sigma 5)
  • cscript corpus 15 (sigma 15)
  • forfiles corpus 2 (sigma 2)
  • hh
  • hh.exe
  • mshta corpus 14 (sigma 14)
  • powershell corpus 25 (sigma 24, chronicle 1)
  • regsvr32 corpus 15 (sigma 15)
  • rundll32 corpus 26 (sigma 23, chronicle 2, kusto 1)
  • scrcons
  • scriptrunner
  • wmic corpus 2 (sigma 2)
  • wmic.exe corpus 2 (sigma 2)
  • wscript corpus 16 (sigma 16)
Imageends_with
  • \schtasks.exe corpus 56 (sigma 56)