Skip to content

Commit 229b9d2

Browse files
update: add more filters and adjust metadata
1 parent 8e05e0e commit 229b9d2

3 files changed

Lines changed: 55 additions & 20 deletions

File tree

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
title: WSL Binary Modification
1+
title: WSL Binary Modification from Installed Location
22
id: 2f400434-01e1-416b-b52c-bb5bfbb9eb78
33
status: experimental
4-
description: Detects the modification of WSL.exe in program files. When WSL or Bash are exectued in Windows, the respective file in the System32 folder is executed and calls WSL.exe from program files.
4+
description: |
5+
Detects the modification of the wsl.exe binary from its installed location.
6+
Attackers can replace the legitimate wsl.exe binary with a malicious payload in its place, which is then executed when the user runs WSL, acting as a proxy execution and defense evasion technique.
57
references:
68
- https://cardinalops.com/blog/bash-and-switch-hijacking-via-windows-subsystem-for-linux/
7-
author: Liran Ravich
8-
date: 2025-10-01
9+
author: Liran Ravich, Swachchhanda Shrawan Poudel (Nextron Systems)
10+
date: 2026-05-05
911
tags:
10-
- attack.defense-evasion
12+
- attack.stealth
1113
- attack.t1036.005
1214
- attack.t1218
1315
logsource:
1416
category: file_event
1517
product: windows
1618
detection:
17-
selection:
18-
TargetFilename|contains: 'c:\program files\wsl\wsl.exe'
19-
condition: selection
19+
selection_wsl_exe:
20+
TargetFilename|endswith: '\wsl.exe'
21+
selection_wsl_folder:
22+
- TargetFilename|contains:
23+
- ':\Program files\wsl\'
24+
- ':\Program files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_'
25+
- TargetFilename|contains|all:
26+
- ':\Users\'
27+
- '\AppData\Local\Microsoft\WindowsApps\'
28+
filter_main_msiexec:
29+
Image:
30+
- 'C:\Windows\System32\msiexec.exe'
31+
- 'C:\Windows\SysWOW64\msiexec.exe'
32+
filter_main_svchost:
33+
Image: 'C:\Windows\System32\svchost.exe'
34+
TargetFilename|contains: '\WindowsApps\'
35+
condition: all of selection_* and not 1 of filter_main_*
2036
falsepositives:
21-
- When installing WSL for the first time, this file is created by msiexec.exe.
22-
level: high
37+
- Legitimate modification of WSL.exe by the user or by Windows updates.
38+
level: medium # keeping as medium as there might still be legitimate process that create wsl.exe

rules/windows/process_creation/proc_creation_win_wsl_executed_from_unusual_directoy.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
title: WSL Executed From Unusual Directory
22
id: 792eba32-3c95-4144-a7dd-030f4a4cdb8b
33
status: experimental
4-
description: Detects the execution of wsl.exe from an unusual path. This could point to a possible hijack of WSL, intended to make it run a malicious payload upon execution of WSL or Bash.
4+
description: |
5+
Detects the execution of wsl.exe from an unusual path.
6+
This could point to a possible hijack of WSL, intended to make it run a malicious payload upon execution of WSL or Bash.
57
references:
68
- https://cardinalops.com/blog/bash-and-switch-hijacking-via-windows-subsystem-for-linux/
7-
author: Liran Ravich
8-
date: 2025-10-01
9+
author: Liran Ravich, Swachchhanda Shrawan Poudel (Nextron Systems)
10+
date: 2026-05-05
911
tags:
10-
- attack.defense-evasion
12+
- attack.stealth
1113
- attack.t1036.005
1214
- attack.t1218
1315
logsource:
@@ -20,12 +22,15 @@ detection:
2022
Image:
2123
- 'C:\Windows\System32\wsl.exe'
2224
- 'C:\Program Files\WSL\wsl.exe'
25+
- 'C:\$windows.~bt\newos\windows\system32\wsl.exe'
2326
filter_main_legit_paths_2:
2427
Image|startswith:
2528
- 'C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_'
2629
- 'C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux'
30+
- 'C:\ProgramData\Microsoft\Windows\Containers\Layers\'
31+
- 'C:\Windows\SoftwareDistribution\Download\'
2732
filter_main_legit_paths_3:
28-
Image|startswith: 'C:\Users'
33+
Image|startswith: 'C:\Users\'
2934
Image|contains: '\AppData\Local\Microsoft\WindowsApps\'
3035
condition: selection_img and not 1 of filter_main_*
3136
falsepositives:
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
title: WSL InstallLocation Registry Key Modification
22
id: 83475063-b1c8-4774-9568-69bbda71a539
33
status: experimental
4-
description: Detects the modification of the registry key realted to WSL InstallLocation. The key points to a path, in which any file named wsl.exe will be executed upon execution of wsl or bash.
4+
description: |
5+
Detects modifications to the Windows Subsystem for Linux (WSL) InstallLocation registry key.
6+
Attackers can modify this registry key to redirect the execution flow of legitimate WSL processes (wsl.exe or bash.exe) to a malicious payload, acting as a proxy execution and defense evasion technique.
57
references:
68
- https://cardinalops.com/blog/bash-and-switch-hijacking-via-windows-subsystem-for-linux/
7-
author: Liran Ravich
8-
date: 2025-10-01
9+
author: Liran Ravich, Swachchhanda Shrawan Poudel (Nextron Systems)
10+
date: 2026-05-05
911
tags:
10-
- attack.defense-evasion
12+
- attack.stealth
13+
- attack.defense-impairment
14+
- attack.persistence
1115
- attack.t1112
1216
- attack.t1218
1317
logsource:
@@ -16,7 +20,17 @@ logsource:
1620
detection:
1721
selection:
1822
TargetObject|contains: '\Lxss\MSI\InstallLocation'
19-
condition: selection
23+
filter_main_legitimate_binary:
24+
- Details: 'C:\Program Files\WSL'
25+
- Details|contains:
26+
- ':\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_'
27+
- '\AppData\Local\Microsoft\WindowsApps'
28+
- '%ProgramFiles%'
29+
filter_main_msiexec:
30+
Image:
31+
- 'C:\Windows\System32\msiexec.exe'
32+
- 'C:\Windows\SysWOW64\msiexec.exe'
33+
condition: selection and not 1 of filter_main_*
2034
falsepositives:
2135
- Unlikely
2236
level: high

0 commit comments

Comments
 (0)