Detection rules › Sigma

Suspicious Schtasks Schedule Types

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

Detects scheduled task creations or modification on a suspicious schedule type

Known false positives

  • Legitimate processes that run at logon. Filter according to your environment

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Suspicious Schtasks Schedule Types
id: 24c8392b-aa3c-46b7-a545-43f71657fe98
related:
    - id: 7a02e22e-b885-4404-b38b-1ddc7e65258a
      type: similar
status: test
description: Detects scheduled task creations or modification on a suspicious schedule type
references:
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-change
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks-create
    - http://blog.talosintelligence.com/2022/09/lazarus-three-rats.html
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-09-09
tags:
    - attack.privilege-escalation
    - attack.persistence
    - attack.execution
    - attack.t1053.005
logsource:
    product: windows
    category: process_creation
detection:
    selection_img:
        - Image|endswith: '\schtasks.exe'
        - OriginalFileName: 'schtasks.exe'
    selection_time:
        CommandLine|contains:
            - ' ONLOGON '
            - ' ONSTART '
            - ' ONCE '
            - ' ONIDLE '
    filter_privs:
        CommandLine|contains:
            - 'NT AUT' # This covers the usual NT AUTHORITY\SYSTEM
            - ' SYSTEM' # SYSTEM is a valid value for schtasks hence it gets it's own value with space
            - 'HIGHEST'
    condition: all of selection_* and not 1 of filter_*
falsepositives:
    - Legitimate processes that run at logon. Filter according to your environment
level: high

Stages and Predicates

Stage 0: condition

all of selection_* and not 1 of filter_*

Stage 1: selection_img

selection_img:
    - Image|endswith: '\schtasks.exe'
    - OriginalFileName: 'schtasks.exe'

Stage 2: selection_time

selection_time:
    CommandLine|contains:
        - ' ONLOGON '
        - ' ONSTART '
        - ' ONCE '
        - ' ONIDLE '

Stage 3: not filter_privs

filter_privs:
    CommandLine|contains:
        - 'NT AUT'
        - ' SYSTEM'
        - 'HIGHEST'

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLinematch
  • ONCE corpus 2 (sigma 2)
  • ONIDLE corpus 2 (sigma 2)
  • ONLOGON corpus 2 (sigma 2)
  • ONSTART corpus 2 (sigma 2)
field:"CommandLine" kind:match
Imageends_with
  • \schtasks.exe corpus 55 (sigma 55)
field:"Image" kind:ends_with value:"\schtasks.exe"
OriginalFileNameeq
  • schtasks.exe corpus 31 (sigma 18, elastic 9, splunk 4)
field:"OriginalFileName" kind:eq value:"schtasks.exe"