Detection rules › Sigma

Always Install Elevated MSI Spawned Cmd And Powershell

Status
test
Severity
medium
Log source
category process_creation, product windows
Author
Teymur Kheirkhabarov (idea), Mangatas Tondang (rule), oscd.community
Source
github.com/SigmaHQ/sigma

Detects Windows Installer service (msiexec.exe) spawning "cmd" or "powershell"

MITRE ATT&CK coverage

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 1: Process creation

Rule body

title: Always Install Elevated MSI Spawned Cmd And Powershell
id: 1e53dd56-8d83-4eb4-a43e-b790a05510aa
status: test
description: Detects Windows Installer service (msiexec.exe) spawning "cmd" or "powershell"
references:
    - https://image.slidesharecdn.com/kheirkhabarovoffzonefinal-181117201458/95/hunting-for-privilege-escalation-in-windows-environment-50-638.jpg
author: Teymur Kheirkhabarov (idea), Mangatas Tondang (rule), oscd.community
date: 2020-10-13
modified: 2022-10-20
tags:
    - attack.privilege-escalation
    - attack.t1548.002
logsource:
    product: windows
    category: process_creation
detection:
    selection_img:
        - Image|endswith:
              - '\cmd.exe'
              - '\powershell.exe'
              - '\pwsh.exe'
        - OriginalFileName:
              - 'Cmd.Exe'
              - 'PowerShell.EXE'
              - 'pwsh.dll'
    selection_parent:
        ParentImage|contains|all:
            - '\Windows\Installer\'
            - 'msi'
        ParentImage|endswith: 'tmp'
    condition: all of selection_*
falsepositives:
    - Unknown
level: medium

Stages and Predicates

Stage 0: condition

all of selection_*

Stage 1: selection_img

selection_img:
    - Image|endswith:
          - '\cmd.exe'
          - '\powershell.exe'
          - '\pwsh.exe'
    - OriginalFileName:
          - 'Cmd.Exe'
          - 'PowerShell.EXE'
          - 'pwsh.dll'

Stage 2: selection_parent

selection_parent:
    ParentImage|contains|all:
        - '\Windows\Installer\'
        - 'msi'
    ParentImage|endswith: 'tmp'

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Imageends_with
  • \cmd.exe corpus 130 (sigma 130)
  • \powershell.exe corpus 179 (sigma 178, kusto 1)
  • \pwsh.exe corpus 165 (sigma 164, kusto 1)
field:"Image" kind:ends_with
OriginalFileNameeq
  • Cmd.Exe corpus 81 (sigma 43, elastic 21, splunk 17)
  • PowerShell.EXE corpus 138 (sigma 84, splunk 30, elastic 24)
  • pwsh.dll corpus 112 (sigma 79, splunk 30, elastic 3)
field:"OriginalFileName" kind:eq
ParentImageends_with
  • tmp
field:"ParentImage" kind:ends_with value:"tmp"
ParentImagematch
  • \Windows\Installer\
  • msi
field:"ParentImage" kind:match