Detection rules › Sigma

Suspicious PowerShell Invocations - Specific - ProcessCreation

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

Detects suspicious PowerShell invocation command parameters

MITRE ATT&CK coverage

TacticTechniques
StealthNo specific technique

Event coverage

Rule body yaml

title: Suspicious PowerShell Invocations - Specific - ProcessCreation
id: 536e2947-3729-478c-9903-745aaffe60d2
related:
    - id: fce5f582-cc00-41e1-941a-c6fabf0fdb8c
      type: obsolete
    - id: ae7fbf8e-f3cb-49fd-8db4-5f3bed522c71
      type: similar
    - id: 8ff28fdd-e2fa-4dfa-aeda-ef3d61c62090
      type: similar
status: test
description: Detects suspicious PowerShell invocation command parameters
references:
    - Internal Research
author: Nasreddine Bencherchali (Nextron Systems)
date: 2023-01-05
tags:
    - attack.stealth
logsource:
    category: process_creation
    product: windows
detection:
    selection_convert_b64:
        CommandLine|contains|all:
            - '-nop'
            - ' -w '
            - 'hidden'
            - ' -c '
            - '[Convert]::FromBase64String'
    selection_iex:
        CommandLine|contains|all:
            - ' -w '
            - 'hidden'
            - '-noni'
            - '-nop'
            - ' -c '
            - 'iex'
            - 'New-Object'
    selection_enc:
        CommandLine|contains|all:
            - ' -w '
            - 'hidden'
            - '-ep'
            - 'bypass'
            - '-Enc'
    selection_reg:
        CommandLine|contains|all:
            - 'powershell'
            - 'reg'
            - 'add'
            - '\software\'
    selection_webclient:
        CommandLine|contains|all:
            - 'bypass'
            - '-noprofile'
            - '-windowstyle'
            - 'hidden'
            - 'new-object'
            - 'system.net.webclient'
            - '.download'
    selection_iex_webclient:
        CommandLine|contains|all:
            - 'iex'
            - 'New-Object'
            - 'Net.WebClient'
            - '.Download'
    filter_chocolatey:
        CommandLine|contains:
            - "(New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1"
            - 'Write-ChocolateyWarning'
    condition: 1 of selection_* and not 1 of filter_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

1 of selection_* and not 1 of filter_*

Stage 1: selection_convert_b64

selection_convert_b64:
    CommandLine|contains|all:
        - '-nop'
        - ' -w '
        - 'hidden'
        - ' -c '
        - '[Convert]::FromBase64String'

Stage 2: selection_iex

selection_iex:
    CommandLine|contains|all:
        - ' -w '
        - 'hidden'
        - '-noni'
        - '-nop'
        - ' -c '
        - 'iex'
        - 'New-Object'

Stage 3: selection_enc

selection_enc:
    CommandLine|contains|all:
        - ' -w '
        - 'hidden'
        - '-ep'
        - 'bypass'
        - '-Enc'

Stage 4: selection_reg

selection_reg:
    CommandLine|contains|all:
        - 'powershell'
        - 'reg'
        - 'add'
        - '\software\'

Stage 5: selection_webclient

selection_webclient:
    CommandLine|contains|all:
        - 'bypass'
        - '-noprofile'
        - '-windowstyle'
        - 'hidden'
        - 'new-object'
        - 'system.net.webclient'
        - '.download'

Stage 6: selection_iex_webclient

selection_iex_webclient:
    CommandLine|contains|all:
        - 'iex'
        - 'New-Object'
        - 'Net.WebClient'
        - '.Download'

Stage 7: not filter_chocolatey

filter_chocolatey:
    CommandLine|contains:
        - "(New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1"
        - 'Write-ChocolateyWarning'

Exclusions

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

FieldKindExcluded values
CommandLinematch(New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1
CommandLinematchWrite-ChocolateyWarning

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 14 (sigma 13, elastic 1)
  • -w
  • -Enc corpus 2 (sigma 2)
  • -ep
  • -noni
  • -nop corpus 2 (sigma 2)
  • -noprofile
  • -windowstyle
  • .Download corpus 2 (sigma 2)
  • .download corpus 2 (sigma 2)
  • Net.WebClient corpus 2 (sigma 2)
  • New-Object corpus 3 (sigma 3)
  • [Convert]::FromBase64String
  • \software\ corpus 2 (sigma 2)
  • add corpus 34 (sigma 26, splunk 4, chronicle 2, kusto 2)
  • bypass corpus 6 (sigma 6)
  • hidden corpus 4 (sigma 4)
  • iex corpus 6 (sigma 5, splunk 1)
  • new-object corpus 3 (sigma 3)
  • powershell corpus 25 (sigma 24, chronicle 1)
  • reg corpus 7 (sigma 5, splunk 1, kusto 1)
  • system.net.webclient corpus 2 (sigma 1, chronicle 1)