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