Detection rules › Sigma

Potentially Suspicious PowerShell Child Processes

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

Detects potentially suspicious child processes spawned by PowerShell. Use this rule to hunt for potential anomalies initiating from PowerShell scripts and commands.

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Potentially Suspicious PowerShell Child Processes
id: e4b6d2a7-d8a4-4f19-acbd-943c16d90647
status: test
description: |
    Detects potentially suspicious child processes spawned by PowerShell.
    Use this rule to hunt for potential anomalies initiating from PowerShell scripts and commands.
references:
    - https://twitter.com/ankit_anubhav/status/1518835408502620162
author: Florian Roth (Nextron Systems), Tim Shelton
date: 2022-04-26
modified: 2024-07-16
tags:
    - attack.execution
    - attack.t1059.001
    - detection.threat-hunting
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        ParentImage|endswith:
            - '\powershell_ise.exe'
            - '\powershell.exe'
            - '\pwsh.exe'
        Image|endswith:
            - '\bash.exe'
            - '\bitsadmin.exe'
            - '\certutil.exe'
            - '\cscript.exe'
            - '\forfiles.exe'
            - '\hh.exe'
            - '\mshta.exe'
            - '\regsvr32.exe'
            - '\rundll32.exe'
            - '\schtasks.exe'
            - '\scrcons.exe'
            - '\scriptrunner.exe'
            - '\sh.exe'
            - '\wmic.exe'
            - '\wscript.exe'
    filter_optional_amazon:
        ParentCommandLine|contains: '\Program Files\Amazon\WorkspacesConfig\Scripts\'  # AWS Workspaces
        CommandLine|contains: '\Program Files\Amazon\WorkspacesConfig\Scripts\'  # AWS Workspaces
    filter_main_certutil_verify_store:
        Image|endswith: '\certutil.exe'
        CommandLine|contains: '-verifystore '
    filter_main_wmic:
        Image|endswith: '\wmic.exe'
        CommandLine|contains:
            - 'qfe list'
            - 'diskdrive '
            - 'csproduct '
            - 'computersystem '
            - ' os '
            - ''
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
    - False positives are to be expected from PowerShell scripts that might make use of additional binaries such as "mshta", "bitsadmin", etc. Apply additional filters for those scripts.
level: medium

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_main_* and not 1 of filter_optional_*

Stage 1: selection

selection:
    ParentImage|endswith:
        - '\powershell_ise.exe'
        - '\powershell.exe'
        - '\pwsh.exe'
    Image|endswith:
        - '\bash.exe'
        - '\bitsadmin.exe'
        - '\certutil.exe'
        - '\cscript.exe'
        - '\forfiles.exe'
        - '\hh.exe'
        - '\mshta.exe'
        - '\regsvr32.exe'
        - '\rundll32.exe'
        - '\schtasks.exe'
        - '\scrcons.exe'
        - '\scriptrunner.exe'
        - '\sh.exe'
        - '\wmic.exe'
        - '\wscript.exe'

Stage 2: not filter_main_*

filter_main_certutil_verify_store:
    Image|endswith: '\certutil.exe'
    CommandLine|contains: '-verifystore '
filter_main_wmic:
    Image|endswith: '\wmic.exe'
    CommandLine|contains:
        - 'qfe list'
        - 'diskdrive '
        - 'csproduct '
        - 'computersystem '
        - ' os '
        - ''

Stage 3: not filter_optional_amazon

filter_optional_amazon:
    ParentCommandLine|contains: '\Program Files\Amazon\WorkspacesConfig\Scripts\'
    CommandLine|contains: '\Program Files\Amazon\WorkspacesConfig\Scripts\'

Exclusions

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

FieldKindExcluded values
CommandLinematch os
CommandLinematchcomputersystem
CommandLinematchcsproduct
CommandLinematchdiskdrive
CommandLinematchqfe list
Imageends_with\wmic.exe
CommandLinematch-verifystore
Imageends_with\certutil.exe
CommandLinematch\Program Files\Amazon\WorkspacesConfig\Scripts\
ParentCommandLinematch\Program Files\Amazon\WorkspacesConfig\Scripts\

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
Imageends_with
  • \bash.exe corpus 22 (sigma 22)
  • \bitsadmin.exe corpus 29 (sigma 29)
  • \certutil.exe corpus 43 (sigma 43)
  • \cscript.exe corpus 73 (sigma 73)
  • \forfiles.exe corpus 12 (sigma 12)
  • \hh.exe corpus 16 (sigma 16)
  • \mshta.exe corpus 67 (sigma 67)
  • \regsvr32.exe corpus 65 (sigma 65)
  • \rundll32.exe corpus 95 (sigma 95)
  • \schtasks.exe corpus 56 (sigma 56)
  • \scrcons.exe corpus 9 (sigma 9)
  • \scriptrunner.exe corpus 12 (sigma 12)
  • \sh.exe corpus 16 (sigma 16)
  • \wmic.exe corpus 60 (sigma 60)
  • \wscript.exe corpus 75 (sigma 75)
ParentImageends_with
  • \powershell.exe corpus 24 (sigma 24)
  • \powershell_ise.exe corpus 3 (sigma 3)
  • \pwsh.exe corpus 21 (sigma 21)