Detection rules › Sigma

Suspicious PowerShell IEX Execution Patterns

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

Detects suspicious ways to run Invoke-Execution using IEX alias

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Suspicious PowerShell IEX Execution Patterns
id: 09576804-7a05-458e-a817-eb718ca91f54
status: test
description: Detects suspicious ways to run Invoke-Execution using IEX alias
references:
    - https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.2
    - https://www.huntress.com/blog/slashandgrab-screen-connect-post-exploitation-in-the-wild-cve-2024-1709-cve-2024-1708
author: Florian Roth (Nextron Systems), Nasreddine Bencherchali (Nextron Systems)
date: 2022-03-24
modified: 2022-11-28
tags:
    - attack.execution
    - attack.t1059.001
logsource:
    product: windows
    category: process_creation
detection:
    selection_combined_1:
        Image|endswith:
            - '\powershell.exe'
            - '\pwsh.exe'
        CommandLine|contains:
            - ' | iex;'
            - ' | iex '
            - ' | iex}'
            - ' | IEX ;'
            - ' | IEX -Error'
            - ' | IEX (new'
            - ');IEX '
    selection_combined_2:
        CommandLine|contains:
            - '::FromBase64String'
            - '.GetString([System.Convert]::'
    selection_standalone:
        CommandLine|contains:
            - ')|iex;$'
            - ');iex($'
            - ');iex $'
            - ' | IEX | '
            - ' | iex\"'
    condition: all of selection_combined_* or selection_standalone
falsepositives:
    - Legitimate scripts that use IEX
level: high

Stages and Predicates

Stage 0: condition

all of selection_combined_* or selection_standalone

Stage 1: selection_combined_1

selection_combined_1:
    Image|endswith:
        - '\powershell.exe'
        - '\pwsh.exe'
    CommandLine|contains:
        - ' | iex;'
        - ' | iex '
        - ' | iex}'
        - ' | IEX ;'
        - ' | IEX -Error'
        - ' | IEX (new'
        - ');IEX '

Stage 2: selection_combined_2

selection_combined_2:
    CommandLine|contains:
        - '::FromBase64String'
        - '.GetString([System.Convert]::'

Stage 3: selection_standalone

selection_standalone:
    CommandLine|contains:
        - ')|iex;$'
        - ');iex($'
        - ');iex $'
        - ' | IEX | '
        - ' | iex\"'

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
  • | IEX (new
  • | IEX -Error
  • | IEX ;
  • | IEX |
  • | iex
  • | iex;
  • | iex\"
  • | iex}
  • );IEX
  • );iex $
  • );iex($
  • )|iex;$
  • .GetString([System.Convert]::
  • ::FromBase64String corpus 2 (sigma 2)
Imageends_with
  • \powershell.exe corpus 182 (sigma 182)
  • \pwsh.exe corpus 168 (sigma 168)