Detection rules › Sigma

Execute Code with Pester.bat as Parent

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

Detects code execution via Pester.bat (Pester - Powershell Modulte for testing)

MITRE ATT&CK coverage

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Execute Code with Pester.bat as Parent
id: 18988e1b-9087-4f8a-82fe-0414dce49878
related:
    - id: 59e938ff-0d6d-4dc3-b13f-36cc28734d4e
      type: similar
status: test
description: Detects code execution via Pester.bat (Pester - Powershell Modulte for testing)
references:
    - https://twitter.com/Oddvarmoe/status/993383596244258816
    - https://twitter.com/_st0pp3r_/status/1560072680887525378
author: frack113, Nasreddine Bencherchali
date: 2022-08-20
tags:
    - attack.execution
    - attack.stealth
    - attack.t1059.001
    - attack.t1216
logsource:
    category: process_creation
    product: windows
detection:
    selection_module:
        ParentImage|endswith:
            - '\powershell.exe'
            - '\pwsh.exe'
        ParentCommandLine|contains: '\WindowsPowerShell\Modules\Pester\'
    selection_cli:
        ParentCommandLine|contains:
            - '{ Invoke-Pester -EnableExit ;'
            - '{ Get-Help "'
    condition: all of selection_*
falsepositives:
    - Legitimate use of Pester for writing tests for Powershell scripts and modules
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_module

selection_module:
    ParentImage|endswith:
        - '\powershell.exe'
        - '\pwsh.exe'
    ParentCommandLine|contains: '\WindowsPowerShell\Modules\Pester\'

Stage 2: selection_cli

selection_cli:
    ParentCommandLine|contains:
        - '{ Invoke-Pester -EnableExit ;'
        - '{ Get-Help "'

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
ParentCommandLinematch
  • \WindowsPowerShell\Modules\Pester\
  • { Get-Help "
  • { Invoke-Pester -EnableExit ;
ParentImageends_with
  • \powershell.exe corpus 24 (sigma 24)
  • \pwsh.exe corpus 21 (sigma 21)