Detection rules › Sigma

Disable-WindowsOptionalFeature Command PowerShell

Status
test
Severity
high
Log source
product windows, category ps_script
Author
frack113
Source
github.com/SigmaHQ/sigma

Detect built in PowerShell cmdlet Disable-WindowsOptionalFeature, Deployment Image Servicing and Management tool. Similar to DISM.exe, this cmdlet is used to enumerate, install, uninstall, configure, and update features and packages in Windows images

MITRE ATT&CK coverage

TacticTechniques
Defense ImpairmentT1685 Disable or Modify Tools

Event coverage

Rule body yaml

title: Disable-WindowsOptionalFeature Command PowerShell
id: 99c4658d-2c5e-4d87-828d-7c066ca537c3
status: test
description: |
    Detect built in PowerShell cmdlet Disable-WindowsOptionalFeature, Deployment Image Servicing and Management tool.
    Similar to DISM.exe, this cmdlet is used to enumerate, install, uninstall, configure, and update features and packages in Windows images
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/5b67c9b141fa3918017f8fa44f2f88f0b1ecb9e1/atomics/T1562.001/T1562.001.md
    - https://learn.microsoft.com/en-us/powershell/module/dism/disable-windowsoptionalfeature?view=windowsserver2022-ps
author: frack113
date: 2022-09-10
tags:
    - attack.defense-impairment
    - attack.t1685
logsource:
    product: windows
    category: ps_script
    definition: 'Requirements: Script Block Logging must be enabled'
detection:
    selection_cmd:
        ScriptBlockText|contains|all:
            - 'Disable-WindowsOptionalFeature'
            - '-Online'
            - '-FeatureName'
    selection_feature:
        # Add any important windows features
        ScriptBlockText|contains:
            - 'Windows-Defender-Gui'
            - 'Windows-Defender-Features'
            - 'Windows-Defender'
            - 'Windows-Defender-ApplicationGuard'
            # - 'Containers-DisposableClientVM' # Windows Sandbox
    condition: all of selection*
falsepositives:
    - Unknown
level: high

Stages and Predicates

Stage 0: condition

all of selection*

Stage 1: selection_cmd

selection_cmd:
    ScriptBlockText|contains|all:
        - 'Disable-WindowsOptionalFeature'
        - '-Online'
        - '-FeatureName'

Stage 2: selection_feature

selection_feature:
    ScriptBlockText|contains:
        - 'Windows-Defender-Gui'
        - 'Windows-Defender-Features'
        - 'Windows-Defender'
        - 'Windows-Defender-ApplicationGuard'

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
ScriptBlockTextmatch
  • -FeatureName corpus 2 (sigma 2)
  • -Online corpus 2 (sigma 2)
  • Disable-WindowsOptionalFeature
  • Windows-Defender
  • Windows-Defender-ApplicationGuard
  • Windows-Defender-Features
  • Windows-Defender-Gui