Detectionmediumtest

Powershell WMI Persistence

Adversaries may establish persistence and elevate privileges by executing malicious content triggered by a Windows Management Instrumentation (WMI) event subscription.

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2021-08-19Updated 2022-12-259e07f6e7-83aa-45c6-998e-0af26efd0a85windows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic1 selector
detection:
    selection_ioc:
        - ScriptBlockText|contains|all:
              - 'New-CimInstance '
              - '-Namespace root/subscription '
              - '-ClassName __EventFilter '
              - '-Property ' # is a variable name
        - ScriptBlockText|contains|all:
              - 'New-CimInstance '
              - '-Namespace root/subscription '
              - '-ClassName CommandLineEventConsumer '
              - '-Property ' # is a variable name
    condition: selection_ioc
False Positives
Unknown

False positive likelihood has not been assessed. Additional context may be needed during triage.

Testing & Validation

Regression Tests

by frack113
Positive Detection Test1 matchevtx

Microsoft-Windows-PowerShell

Rule Metadata
Rule ID
9e07f6e7-83aa-45c6-998e-0af26efd0a85
Status
test
Level
medium
Type
Detection
Created
2021-08-19
Modified
2022-12-25
Path
rules/windows/powershell/powershell_script/posh_ps_wmi_persistence.yml
Raw Tags
attack.persistenceattack.privilege-escalationattack.t1546.003
View on GitHub