Execution via Windows Subsystem for Linux

Detects attempts to execute a program on the host from the Windows Subsystem for Linux. Adversaries may enable and use WSL for Linux to avoid detection.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2023/01/12"
 3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
 4maturity = "production"
 5updated_date = "2024/10/31"
 6min_stack_version = "8.14.0"
 7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Detects attempts to execute a program on the host from the Windows Subsystem for Linux. Adversaries may enable and use
13WSL for Linux to avoid detection.
14"""
15from = "now-9m"
16index = [
17    "winlogbeat-*",
18    "logs-endpoint.events.process-*",
19    "logs-windows.*",
20    "endgame-*",
21    "logs-system.security*",
22    "logs-m365_defender.event-*",
23    "logs-sentinel_one_cloud_funnel.*",
24    "logs-crowdstrike.fdr*",
25]
26language = "eql"
27license = "Elastic License v2"
28name = "Execution via Windows Subsystem for Linux"
29references = ["https://learn.microsoft.com/en-us/windows/wsl/wsl-config"]
30risk_score = 47
31rule_id = "db7dbad5-08d2-4d25-b9b1-d3a1e4a15efd"
32severity = "medium"
33tags = [
34    "Domain: Endpoint",
35    "OS: Windows",
36    "Use Case: Threat Detection",
37    "Tactic: Defense Evasion",
38    "Data Source: Elastic Endgame",
39    "Data Source: Elastic Defend",
40    "Data Source: System",
41    "Data Source: Microsoft Defender for Endpoint",
42    "Data Source: SentinelOne",
43    "Data Source: Crowdstrike",
44]
45timestamp_override = "event.ingested"
46type = "eql"
47
48query = '''
49process where host.os.type == "windows" and event.type : "start" and
50  process.parent.name : ("wsl.exe", "wslhost.exe") and
51  not process.executable : (
52        "?:\\Program Files (x86)\\*",
53        "?:\\Program Files\\*",
54        "?:\\Program Files*\\WindowsApps\\MicrosoftCorporationII.WindowsSubsystemForLinux_*\\wsl*.exe",
55        "?:\\Windows\\System32\\conhost.exe",
56        "?:\\Windows\\System32\\lxss\\wslhost.exe",
57        "?:\\Windows\\System32\\WerFault.exe",
58        "?:\\Windows\\Sys?????\\wslconfig.exe"
59  ) and
60  not (
61    event.dataset == "crowdstrike.fdr" and
62      process.executable : (
63        "\\Device\\HarddiskVolume?\\Program Files (x86)\\*",
64        "\\Device\\HarddiskVolume?\\Program Files\\*",
65        "\\Device\\HarddiskVolume?\\Program Files*\\WindowsApps\\MicrosoftCorporationII.WindowsSubsystemForLinux_*\\wsl*.exe",
66        "\\Device\\HarddiskVolume?\\Windows\\System32\\conhost.exe",
67        "\\Device\\HarddiskVolume?\\Windows\\System32\\lxss\\wslhost.exe",
68        "\\Device\\HarddiskVolume?\\Windows\\System32\\WerFault.exe",
69        "\\Device\\HarddiskVolume?\\Windows\\Sys?????\\wslconfig.exe"
70      )
71  )
72'''
73
74
75[[rule.threat]]
76framework = "MITRE ATT&CK"
77[[rule.threat.technique]]
78id = "T1202"
79name = "Indirect Command Execution"
80reference = "https://attack.mitre.org/techniques/T1202/"
81
82
83[rule.threat.tactic]
84id = "TA0005"
85name = "Defense Evasion"
86reference = "https://attack.mitre.org/tactics/TA0005/"

References

Related rules

to-top