Wireless Credential Dumping using Netsh Command

Identifies attempts to dump Wireless saved access keys in clear text using the Windows built-in utility Netsh.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2022/11/01"
  3integration = ["endpoint", "system", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2024/11/02"
  6min_stack_version = "8.14.0"
  7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
  8
  9[transform]
 10[[transform.osquery]]
 11label = "Osquery - Retrieve DNS Cache"
 12query = "SELECT * FROM dns_cache"
 13
 14[[transform.osquery]]
 15label = "Osquery - Retrieve All Services"
 16query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
 17
 18[[transform.osquery]]
 19label = "Osquery - Retrieve Services Running on User Accounts"
 20query = """
 21SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
 22NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
 23user_account == null)
 24"""
 25
 26[[transform.osquery]]
 27label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
 28query = """
 29SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
 30services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
 31authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
 32"""
 33
 34
 35[rule]
 36author = ["Elastic"]
 37description = "Identifies attempts to dump Wireless saved access keys in clear text using the Windows built-in utility Netsh."
 38from = "now-9m"
 39index = [
 40    "winlogbeat-*",
 41    "logs-endpoint.events.process-*",
 42    "logs-windows.forwarded*",
 43    "logs-windows.sysmon_operational-*",
 44    "endgame-*",
 45    "logs-system.security*",
 46    "logs-m365_defender.event-*",
 47    "logs-sentinel_one_cloud_funnel.*",
 48    "logs-crowdstrike.fdr*",
 49]
 50language = "eql"
 51license = "Elastic License v2"
 52name = "Wireless Credential Dumping using Netsh Command"
 53note = """## Triage and analysis
 54
 55### Investigating Wireless Credential Dumping using Netsh Command
 56
 57Netsh is a Windows command line tool used for network configuration and troubleshooting. It enables the management of network settings and adapters, wireless network profiles, and other network-related tasks.
 58
 59This rule looks for patterns used to dump credentials from wireless network profiles using Netsh, which can enable attackers to bring their own devices to the network.
 60
 61> **Note**:
 62> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/master/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
 63
 64#### Possible investigation steps
 65
 66- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 67- Investigate other alerts associated with the user/host during the past 48 hours.
 68- Inspect the host for suspicious or abnormal behavior in the alert timeframe:
 69  - Observe and collect information about the following activities in the alert subject host:
 70    - Attempts to contact external domains and addresses.
 71      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 72      - Examine the DNS cache for suspicious or anomalous entries.
 73        - $osquery_0
 74    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 75    - Examine the host services for suspicious or anomalous entries.
 76      - $osquery_1
 77      - $osquery_2
 78      - $osquery_3
 79
 80### False positive analysis
 81
 82- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
 83
 84### Response and remediation
 85
 86- Initiate the incident response process based on the outcome of the triage.
 87- Isolate the involved host to prevent further post-compromise behavior.
 88- 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.
 89- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
 90- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 91- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 92- 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).
 93"""
 94references = [
 95    "https://learn.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-contexts",
 96    "https://www.geeksforgeeks.org/how-to-find-the-wi-fi-password-using-cmd-in-windows/",
 97]
 98risk_score = 73
 99rule_id = "2de87d72-ee0c-43e2-b975-5f0b029ac600"
100severity = "high"
101tags = [
102    "Domain: Endpoint",
103    "OS: Windows",
104    "Use Case: Threat Detection",
105    "Tactic: Credential Access",
106    "Tactic: Discovery",
107    "Data Source: Elastic Endgame",
108    "Resources: Investigation Guide",
109    "Data Source: Elastic Defend",
110    "Data Source: System",
111    "Data Source: Microsoft Defender for Endpoint",
112    "Data Source: Sysmon",
113    "Data Source: SentinelOne",
114    "Data Source: Crowdstrike",
115]
116timestamp_override = "event.ingested"
117type = "eql"
118
119query = '''
120process where host.os.type == "windows" and event.type == "start" and
121 (process.name : "netsh.exe" or ?process.pe.original_file_name == "netsh.exe") and
122  process.args : "wlan" and process.args : "key*clear"
123'''
124
125
126[[rule.threat]]
127framework = "MITRE ATT&CK"
128[[rule.threat.technique]]
129id = "T1003"
130name = "OS Credential Dumping"
131reference = "https://attack.mitre.org/techniques/T1003/"
132
133[[rule.threat.technique]]
134id = "T1555"
135name = "Credentials from Password Stores"
136reference = "https://attack.mitre.org/techniques/T1555/"
137
138
139[rule.threat.tactic]
140id = "TA0006"
141name = "Credential Access"
142reference = "https://attack.mitre.org/tactics/TA0006/"
143[[rule.threat]]
144framework = "MITRE ATT&CK"
145[[rule.threat.technique]]
146id = "T1082"
147name = "System Information Discovery"
148reference = "https://attack.mitre.org/techniques/T1082/"
149
150
151[rule.threat.tactic]
152id = "TA0007"
153name = "Discovery"
154reference = "https://attack.mitre.org/tactics/TA0007/"

Triage and analysis

Investigating Wireless Credential Dumping using Netsh Command

Netsh is a Windows command line tool used for network configuration and troubleshooting. It enables the management of network settings and adapters, wireless network profiles, and other network-related tasks.

This rule looks for patterns used to dump credentials from wireless network profiles using Netsh, which can enable attackers to bring their own devices to the network.

Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Inspect the host for suspicious or abnormal behavior in the alert timeframe:
    • Observe and collect information about the following activities in the alert subject host:
      • Attempts to contact external domains and addresses.
        • Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' process.entity_id.
        • Examine the DNS cache for suspicious or anomalous entries.
          • $osquery_0
      • Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
      • Examine the host services for suspicious or anomalous entries.
        • $osquery_1
        • $osquery_2
        • $osquery_3

False positive analysis

  • This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.

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.
  • 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.
  • Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • 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