Sigma rule: Arbitrary Command Execution Using WSL
A detection rule from the SigmaHQ repository, shown as its author published it. Dataset version ref-ba95acbd8069, updated 2023-04-12T00:00:00.000Z.
Rule
- Title
- Arbitrary Command Execution Using WSL
- Status
- test
- Level
- medium
- Author
- oscd.community, Zach Stanford @svch0st, Nasreddine Bencherchali (Nextron Systems)
- Date
- 2020-10-05
- Modified
- 2023-04-12
- File
- rules-threat-hunting/windows/process_creation/proc_creation_win_wsl_arbitrary_command_execution.yml
- Commit
- ccbb0369507f796db0b0ae6854c8a2be471b9d84
Detects potential abuse of Windows Subsystem for Linux (WSL) binary as a Living of the Land binary in order to execute arbitrary Linux or Windows commands.
Log source
- product
- windows
- category
- process_creation
Detection
selection_img:
- Image|endswith: '\wsl.exe'
- OriginalFileName: 'wsl.exe'
selection_cli:
CommandLine|contains:
- ' -e '
- ' --exec'
- ' --system'
- ' --shell-type '
- ' /mnt/c' # Path to mounted "C:\" partition (Indication of running Windows binaries via WSL)
- ' --user root'
- ' -u root'
- '--debug-shell'
filter_main_kill:
# This filter is to handle a FP that occurs when a process is spawned from WSL and then closed by the user
# Example would be to open VsCode through it's server extension from WSL
# GrandparentCommandLine: "C:\Users\XXX\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node c:\Users\XXX\.vscode\extensions\ms-vscode-remote.remote-wsl-0.72.0\dist\wslDaemon.js
# ParentCommandLine: C:\WINDOWS\system32\cmd.exe /d /s /c "C:\WINDOWS\System32\wsl.exe -d Ubuntu-20.04 -e kill 1366"
# CommandLine: C:\WINDOWS\System32\wsl.exe -d Ubuntu-20.04 -e kill 1366
ParentImage|endswith: '\cmd.exe'
CommandLine|contains|all:
- ' -d '
- ' -e kill '
condition: all of selection_* and not 1 of filter_main_*False positives (as the rule lists them)
- Automation and orchestration scripts may use this method to execute scripts etc.
- Legitimate use by Windows to kill processes opened via WSL (example VsCode WSL server)
Tags
- attack.execution
- attack.stealth
- attack.t1218
- attack.t1202
- detection.threat-hunting
MITRE ATT&CK ids this rule names
Related rules
References
- https://lolbas-project.github.io/lolbas/OtherMSBinaries/Wsl/
- https://twitter.com/nas_bench/status/1535431474429808642
Read on 2026-11-03T00:58:21.399Z under licence sigma-drl-1.1@d5f4c36a from https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/windows/process_creation/proc_creation_win_wsl_arbitrary_command_execution.yml
Sources and licences
SigmaHQ
"Arbitrary Command Execution Using WSL" by oscd.community, Zach Stanford @svch0st, Nasreddine Bencherchali (Nextron Systems) (SigmaHQ). Rule: https://github.com/SigmaHQ/sigma/blob/ccbb0369507f796db0b0ae6854c8a2be471b9d84/rules-threat-hunting/windows/process_creation/proc_creation_win_wsl_arbitrary_command_execution.yml.
Licensed under the Detection Rule License (DRL) 1.1: https://github.com/SigmaHQ/Detection-Rule-License
Cite this page
Dragons Eye Ransomware Tracker, "Sigma rule: Arbitrary Command Execution Using WSL",
entity page, dataset version ref-ba95acbd8069, updated 2023-04-12T00:00:00.000Z,
https://ransomware-tracker.com/detections/sigma/dec44ca7-61ad-493c-bfd7-8819c5faa09b (accessed 2026-11-03).
Underlying source: SigmaHQ rule dec44ca7-61ad-493c-bfd7-8819c5faa09b, commit ccbb0369507f796db0b0ae6854c8a2be471b9d84.
Pages change. The dataset version identifies the data, but no archive of old versions is kept, so this citation cannot be replayed later.