Detection rules › Sigma

Windows Subsystem for Linux (WSL) installation (PowerShell)

Status
experimental
Severity
medium
Log source
product windows, category ['ps_module', 'ps_classic_script', 'ps_script']
Author
mdecrevoisier
Source
github.com/mdecrevoisier/SIGMA-detection-rules

Detects scenarios where an attacker enables the WSL to cary out malicious activities in a virtual instance to avoid detection.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Windows Subsystem for Linux (WSL) installation (PowerShell)
description: Detects scenarios where an attacker enables the WSL to cary out malicious activities in a virtual instance to avoid detection.
references:
- https://www.hackers-arise.com/post/linux-basics-for-hackers-part-13-the-windows-subsystem-for-linux-wsl
- https://linuxhint.com/enable-wsl-optional-component/
- https://blog.lumen.com/no-longer-just-theory-black-lotus-labs-uncovers-linux-executables-deployed-as-stealth-windows-loaders/
- https://learn.microsoft.com/en-us/windows/wsl/
tags:
- attack.defense_evasion
- attack.t1564.006
author: mdecrevoisier
status: experimental
logsource:
  product: windows
  category:
    - ps_module
    - ps_classic_script
    - ps_script
detection: # full command "Enable-windowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"
  selection2_powershell_modern:
    EventID: 4103
    Payload|contains:
      - 'Enable-windowsOptionalFeature'
      - 'Microsoft-Windows-Subsystem-Linux'

  selection3_powershell_block:
    EventID: 4104
    ScriptBlockText|contains:
      - 'Enable-windowsOptionalFeature'
      - 'Microsoft-Windows-Subsystem-Linux'

  condition: 1 of selection*
falsepositives:
- developer computer (with Visual Studio Code)
- administrator activity
level: medium

Stages and Predicates

Stage 0: condition

1 of selection*

Stage 1: selection2_powershell_modern

selection2_powershell_modern:
  EventID: 4103
  Payload|contains:
    - 'Enable-windowsOptionalFeature'
    - 'Microsoft-Windows-Subsystem-Linux'

Stage 2: selection3_powershell_block

selection3_powershell_block:
  EventID: 4104
  ScriptBlockText|contains:
    - 'Enable-windowsOptionalFeature'
    - 'Microsoft-Windows-Subsystem-Linux'

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
Payloadmatch
  • Enable-windowsOptionalFeature
  • Microsoft-Windows-Subsystem-Linux
ScriptBlockTextmatch
  • Enable-windowsOptionalFeature corpus 3 (sigma 2, splunk 1)
  • Microsoft-Windows-Subsystem-Linux corpus 2 (sigma 2)