Windows Subsystem for Linux Distribution Installed

Detects changes to the registry that indicates the install of a new Windows Subsystem for Linux distribution by name. 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", "m365_defender", "sentinel_one_cloud_funnel"]
  4maturity = "production"
  5updated_date = "2024/10/15"
  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 changes to the registry that indicates the install of a new Windows Subsystem for Linux distribution by name.
 13Adversaries may enable and use WSL for Linux to avoid detection.
 14"""
 15from = "now-9m"
 16index = [
 17    "winlogbeat-*",
 18    "logs-endpoint.events.registry-*",
 19    "logs-windows.sysmon_operational-*",
 20    "endgame-*",
 21    "logs-m365_defender.event-*",
 22    "logs-sentinel_one_cloud_funnel.*"
 23]
 24language = "eql"
 25license = "Elastic License v2"
 26name = "Windows Subsystem for Linux Distribution Installed"
 27note = """## Triage and analysis
 28
 29### Investigating Windows Subsystem for Linux Distribution Installed
 30
 31The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup. Attackers may abuse WSL to avoid security protections on a Windows host and perform a wide range of attacks.
 32
 33This rule identifies the installation of a new Windows Subsystem for Linux distribution via registry events.
 34
 35### Possible investigation steps
 36
 37- Identify the user account that performed the action and whether it should perform this kind of action.
 38- Examine which distribution was installed. Some distributions such as Kali Linux can facilitate the compromise of the environment.
 39- Contact the account owner and confirm whether they are aware of this activity.
 40- Investigate other alerts associated with the user/host during the past 48 hours.
 41- Validate that the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
 42- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 43
 44### False positive analysis
 45
 46- This is a dual-use tool, meaning its usage is not inherently malicious. Analysts can dismiss the alert if the administrator is aware of the activity, no other suspicious activity was identified, and the WSL distribution is homologated and approved in the environment.
 47
 48### Related Rules
 49
 50- Host Files System Changes via Windows Subsystem for Linux - e88d1fe9-b2f4-48d4-bace-a026dc745d4b
 51- Execution via Windows Subsystem for Linux - db7dbad5-08d2-4d25-b9b1-d3a1e4a15efd
 52- Suspicious Execution via Windows Subsystem for Linux - 3e0eeb75-16e8-4f2f-9826-62461ca128b7
 53- Windows Subsystem for Linux Enabled via Dism Utility - e2e0537d-7d8f-4910-a11d-559bcf61295a
 54
 55### Response and Remediation
 56
 57- Initiate the incident response process based on the outcome of the triage.
 58- Isolate the involved host to prevent further post-compromise behavior.
 59- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 60- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 61- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 62- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 63"""
 64references = ["https://learn.microsoft.com/en-us/windows/wsl/wsl-config"]
 65risk_score = 47
 66rule_id = "a1699af0-8e1e-4ed0-8ec1-89783538a061"
 67severity = "medium"
 68tags = [
 69    "Domain: Endpoint",
 70    "OS: Windows",
 71    "Use Case: Threat Detection",
 72    "Tactic: Defense Evasion",
 73    "Data Source: Elastic Endgame",
 74    "Data Source: Elastic Defend",
 75    "Data Source: Sysmon",
 76    "Data Source: Microsoft Defender for Endpoint",
 77    "Data Source: SentinelOne",
 78]
 79timeline_id = "3e47ef71-ebfc-4520-975c-cb27fc090799"
 80timeline_title = "Comprehensive Registry Timeline"
 81timestamp_override = "event.ingested"
 82type = "eql"
 83
 84query = '''
 85registry where host.os.type == "windows" and event.type == "change" and registry.value : "PackageFamilyName" and
 86 registry.path : "*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Lxss\\*\\PackageFamilyName"
 87'''
 88
 89
 90[[rule.threat]]
 91framework = "MITRE ATT&CK"
 92[[rule.threat.technique]]
 93id = "T1112"
 94name = "Modify Registry"
 95reference = "https://attack.mitre.org/techniques/T1112/"
 96
 97[[rule.threat.technique]]
 98id = "T1202"
 99name = "Indirect Command Execution"
100reference = "https://attack.mitre.org/techniques/T1202/"
101
102
103[rule.threat.tactic]
104id = "TA0005"
105name = "Defense Evasion"
106reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Windows Subsystem for Linux Distribution Installed

The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup. Attackers may abuse WSL to avoid security protections on a Windows host and perform a wide range of attacks.

This rule identifies the installation of a new Windows Subsystem for Linux distribution via registry events.

Possible investigation steps

  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Examine which distribution was installed. Some distributions such as Kali Linux can facilitate the compromise of the environment.
  • Contact the account owner and confirm whether they are aware of this activity.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Validate that the activity is not related to planned patches, updates, network administrator activity, or legitimate software installations.
  • Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.

False positive analysis

  • This is a dual-use tool, meaning its usage is not inherently malicious. Analysts can dismiss the alert if the administrator is aware of the activity, no other suspicious activity was identified, and the WSL distribution is homologated and approved in the environment.
  • Host Files System Changes via Windows Subsystem for Linux - e88d1fe9-b2f4-48d4-bace-a026dc745d4b
  • Execution via Windows Subsystem for Linux - db7dbad5-08d2-4d25-b9b1-d3a1e4a15efd
  • Suspicious Execution via Windows Subsystem for Linux - 3e0eeb75-16e8-4f2f-9826-62461ca128b7
  • Windows Subsystem for Linux Enabled via Dism Utility - e2e0537d-7d8f-4910-a11d-559bcf61295a

Response and Remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved host to prevent further post-compromise behavior.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top