Detection rules › Sigma

Run PowerShell Script from Redirected Input Stream

Status
test
Severity
high
Log source
category process_creation, product windows
Author
Moriarty Meng (idea), Anton Kutepov (rule), oscd.community
Source
github.com/SigmaHQ/sigma

Detects PowerShell script execution via input stream redirect

MITRE ATT&CK coverage

Telemetry coverage

Rule body

title: Run PowerShell Script from Redirected Input Stream
id: c83bf4b5-cdf0-437c-90fa-43d734f7c476
status: test
description: Detects PowerShell script execution via input stream redirect
references:
    - https://github.com/LOLBAS-Project/LOLBAS/blob/4db780e0f0b2e2bb8cb1fa13e09196da9b9f1834/yml/LOLUtilz/OSBinaries/Powershell.yml
    - https://twitter.com/Moriarty_Meng/status/984380793383370752
author: Moriarty Meng (idea), Anton Kutepov (rule), oscd.community
date: 2020-10-17
modified: 2021-11-27
tags:
    - attack.execution
    - attack.t1059
logsource:
    category: process_creation
    product: windows
detection:
    selection:
        Image|endswith:
            - '\powershell.exe'
            - '\pwsh.exe'
        CommandLine|re: '\s-\s*<'
    condition: selection
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

selection

Stage 1: selection

selection:
    Image|endswith:
        - '\powershell.exe'
        - '\pwsh.exe'
    CommandLine|re: '\s-\s*<'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
CommandLineregex_match
  • \s-\s*<
field:"CommandLine" kind:regex_match value:"\s-\s*<"
Imageends_with
  • \powershell.exe corpus 179 (sigma 178, kusto 1)
  • \pwsh.exe corpus 165 (sigma 164, kusto 1)
field:"Image" kind:ends_with