Detection rules › Sigma

Suspicious WindowsTerminal Child Processes

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

Detects suspicious children spawned via the Windows Terminal application which could be a sign of persistence via WindowsTerminal (see references section)

MITRE ATT&CK coverage

TacticTechniques
ExecutionNo specific technique
PersistenceNo specific technique

Event coverage

Rule body yaml

title: Suspicious WindowsTerminal Child Processes
id: 8de89e52-f6e1-4b5b-afd1-41ecfa300d48
status: test
description: Detects suspicious children spawned via the Windows Terminal application which could be a sign of persistence via WindowsTerminal (see references section)
references:
    - https://persistence-info.github.io/Data/windowsterminalprofile.html
    - https://twitter.com/nas_bench/status/1550836225652686848
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-07-25
modified: 2023-02-14
tags:
    - attack.execution
    - attack.persistence
logsource:
    category: process_creation
    product: windows
detection:
    selection_parent:
        ParentImage|endswith:
            - '\WindowsTerminal.exe'
            - '\wt.exe'
    selection_susp:
        - Image|endswith:
              # Add more LOLBINS
              - '\rundll32.exe'
              - '\regsvr32.exe'
              - '\certutil.exe'
              - '\cscript.exe'
              - '\wscript.exe'
              - '\csc.exe'
        - Image|contains:
              # Add more suspicious paths
              - 'C:\Users\Public\'
              - '\Downloads\'
              - '\Desktop\'
              - '\AppData\Local\Temp\'
              - '\Windows\TEMP\'
        - CommandLine|contains:
              # Add more suspicious commandline
              - ' iex '
              - ' icm'
              - 'Invoke-'
              - 'Import-Module '
              - 'ipmo '
              - 'DownloadString('
              - ' /c '
              - ' /k '
              - ' /r '
    filter_builtin_visual_studio_shell:
        CommandLine|contains|all:
            - 'Import-Module'
            - 'Microsoft.VisualStudio.DevShell.dll'
            - 'Enter-VsDevShell'
    filter_open_settings:
        CommandLine|contains|all:
            - '\AppData\Local\Packages\Microsoft.WindowsTerminal_'
            - '\LocalState\settings.json'
    filter_vsdevcmd:
        CommandLine|contains|all:
            - 'C:\Program Files\Microsoft Visual Studio\'
            - '\Common7\Tools\VsDevCmd.bat'
    condition: all of selection_* and not 1 of filter_*
falsepositives:
    - Other legitimate "Windows Terminal" profiles
level: medium

Stages and Predicates

Stage 0: condition

all of selection_* and not 1 of filter_*

Stage 1: selection_parent

selection_parent:
    ParentImage|endswith:
        - '\WindowsTerminal.exe'
        - '\wt.exe'

Stage 2: selection_susp

selection_susp:
    - Image|endswith:
          - '\rundll32.exe'
          - '\regsvr32.exe'
          - '\certutil.exe'
          - '\cscript.exe'
          - '\wscript.exe'
          - '\csc.exe'
    - Image|contains:
          - 'C:\Users\Public\'
          - '\Downloads\'
          - '\Desktop\'
          - '\AppData\Local\Temp\'
          - '\Windows\TEMP\'
    - CommandLine|contains:
          - ' iex '
          - ' icm'
          - 'Invoke-'
          - 'Import-Module '
          - 'ipmo '
          - 'DownloadString('
          - ' /c '
          - ' /k '
          - ' /r '

Stage 3: not filter_*

filter_builtin_visual_studio_shell:
    CommandLine|contains|all:
        - 'Import-Module'
        - 'Microsoft.VisualStudio.DevShell.dll'
        - 'Enter-VsDevShell'
filter_open_settings:
    CommandLine|contains|all:
        - '\AppData\Local\Packages\Microsoft.WindowsTerminal_'
        - '\LocalState\settings.json'
filter_vsdevcmd:
    CommandLine|contains|all:
        - 'C:\Program Files\Microsoft Visual Studio\'
        - '\Common7\Tools\VsDevCmd.bat'

Exclusions

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

FieldKindExcluded values
CommandLinematchC:\Program Files\Microsoft Visual Studio\
CommandLinematch\Common7\Tools\VsDevCmd.bat
CommandLinematchEnter-VsDevShell
CommandLinematchImport-Module
CommandLinematchMicrosoft.VisualStudio.DevShell.dll
CommandLinematch\AppData\Local\Packages\Microsoft.WindowsTerminal_
CommandLinematch\LocalState\settings.json

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
  • /c corpus 6 (sigma 4, splunk 2)
  • /k
  • /r
  • icm
  • iex
  • DownloadString(
  • Import-Module corpus 3 (sigma 3)
  • Invoke- corpus 6 (sigma 6)
  • ipmo corpus 3 (sigma 3)
Imageends_with
  • \certutil.exe corpus 43 (sigma 43)
  • \csc.exe corpus 9 (sigma 9)
  • \cscript.exe corpus 73 (sigma 73)
  • \regsvr32.exe corpus 65 (sigma 65)
  • \rundll32.exe corpus 95 (sigma 95)
  • \wscript.exe corpus 75 (sigma 75)
Imagematch
  • C:\Users\Public\ corpus 2 (sigma 2)
  • \AppData\Local\Temp\ corpus 11 (sigma 11)
  • \Desktop\ corpus 7 (sigma 7)
  • \Downloads\ corpus 10 (sigma 10)
  • \Windows\TEMP\ corpus 8 (sigma 8)
ParentImageends_with
  • \WindowsTerminal.exe
  • \wt.exe