Detectionhightest

Disable-WindowsOptionalFeature Command PowerShell

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

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2022-09-1099c4658d-2c5e-4d87-828d-7c066ca537c3windows
Log Source
WindowsPowerShell Script
ProductWindows← raw: windows
CategoryPowerShell Script← raw: ps_script

Definition

Requirements: Script Block Logging must be enabled

Detection Logic
Detection Logic2 selectors
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*
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
99c4658d-2c5e-4d87-828d-7c066ca537c3
Status
test
Level
high
Type
Detection
Created
2022-09-10
Path
rules/windows/powershell/powershell_script/posh_ps_disable_windows_optional_feature.yml
Raw Tags
attack.defense-impairmentattack.t1685
View on GitHub