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"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/03/28"
  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 = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.*", "endgame-*", "logs-system.security*"]
 40language = "eql"
 41license = "Elastic License v2"
 42name = "Wireless Credential Dumping using Netsh Command"
 43note = """## Triage and analysis
 44
 45### Investigating Wireless Credential Dumping using Netsh Command
 46
 47Netsh 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.
 48
 49This 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.
 50
 51> **Note**:
 52> 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.
 53
 54#### Possible investigation steps
 55
 56- 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.
 57- Investigate other alerts associated with the user/host during the past 48 hours.
 58- Inspect the host for suspicious or abnormal behavior in the alert timeframe:
 59  - Observe and collect information about the following activities in the alert subject host:
 60    - Attempts to contact external domains and addresses.
 61      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 62      - Examine the DNS cache for suspicious or anomalous entries.
 63        - $osquery_0
 64    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 65    - Examine the host services for suspicious or anomalous entries.
 66      - $osquery_1
 67      - $osquery_2
 68      - $osquery_3
 69
 70### False positive analysis
 71
 72- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.
 73
 74### Response and remediation
 75
 76- Initiate the incident response process based on the outcome of the triage.
 77- Isolate the involved host to prevent further post-compromise behavior.
 78- 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.
 79- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
 80- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 81- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 82- 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).
 83"""
 84references = [
 85    "https://learn.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-contexts",
 86    "https://www.geeksforgeeks.org/how-to-find-the-wi-fi-password-using-cmd-in-windows/",
 87]
 88risk_score = 73
 89rule_id = "2de87d72-ee0c-43e2-b975-5f0b029ac600"
 90severity = "high"
 91tags = [
 92    "Domain: Endpoint",
 93    "OS: Windows",
 94    "Use Case: Threat Detection",
 95    "Tactic: Credential Access",
 96    "Tactic: Discovery",
 97    "Data Source: Elastic Endgame",
 98    "Resources: Investigation Guide",
 99    "Data Source: Elastic Defend"
100]
101timestamp_override = "event.ingested"
102type = "eql"
103
104query = '''
105process where host.os.type == "windows" and event.type == "start" and
106 (process.name : "netsh.exe" or ?process.pe.original_file_name == "netsh.exe") and
107  process.args : "wlan" and process.args : "key*clear"
108'''
109
110
111[[rule.threat]]
112framework = "MITRE ATT&CK"
113[[rule.threat.technique]]
114id = "T1003"
115name = "OS Credential Dumping"
116reference = "https://attack.mitre.org/techniques/T1003/"
117
118[[rule.threat.technique]]
119id = "T1555"
120name = "Credentials from Password Stores"
121reference = "https://attack.mitre.org/techniques/T1555/"
122
123
124[rule.threat.tactic]
125id = "TA0006"
126name = "Credential Access"
127reference = "https://attack.mitre.org/tactics/TA0006/"
128[[rule.threat]]
129framework = "MITRE ATT&CK"
130[[rule.threat.technique]]
131id = "T1082"
132name = "System Information Discovery"
133reference = "https://attack.mitre.org/techniques/T1082/"
134
135
136[rule.threat.tactic]
137id = "TA0007"
138name = "Discovery"
139reference = "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