Enumeration of Privileged Local Groups Membership

Identifies instances of an unusual process enumerating built-in Windows privileged local groups membership like Administrators or Remote Desktop users.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/10/15"
  3integration = ["system", "windows"]
  4maturity = "production"
  5updated_date = "2026/09/18"
  6[transform]
  7[[transform.osquery]]
  8label = "Osquery - Retrieve DNS Cache"
  9query = "SELECT * FROM dns_cache"
 10
 11[[transform.osquery]]
 12label = "Osquery - Retrieve All Services"
 13query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
 14
 15[[transform.osquery]]
 16label = "Osquery - Retrieve Services Running on User Accounts"
 17query = """
 18SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
 19NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
 20user_account == null)
 21"""
 22
 23[[transform.osquery]]
 24label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
 25query = """
 26SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
 27services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
 28authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
 29"""
 30
 31
 32[rule]
 33author = ["Elastic"]
 34description = """
 35Identifies instances of an unusual process enumerating built-in Windows privileged local groups membership like
 36Administrators or Remote Desktop users.
 37"""
 38from = "now-9m"
 39index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
 40language = "kuery"
 41license = "Elastic License v2"
 42name = "Enumeration of Privileged Local Groups Membership"
 43note = """## Triage and analysis
 44
 45### Investigating Enumeration of Privileged Local Groups Membership
 46
 47After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.
 48
 49This rule looks for the enumeration of privileged local groups' membership by suspicious processes, and excludes known legitimate utilities and programs installed. Attackers can use this information to decide the next steps of the attack, such as mapping targets for credential compromise and other post-exploitation activities.
 50
 51> **Note**:
 52> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/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- Identify the process, host and user involved on the event.
 57- 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.
 58- Investigate other alerts associated with the user/host during the past 48 hours.
 59- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
 60- Examine the host for derived artifacts that indicate suspicious activities:
 61  - Analyze the process executable using a private sandboxed analysis system.
 62  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
 63    - Attempts to contact external domains and addresses.
 64      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
 65      - Examine the DNS cache for suspicious or anomalous entries.
 66        - $osquery_0
 67    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
 68    - Examine the host services for suspicious or anomalous entries.
 69      - $osquery_1
 70      - $osquery_2
 71      - $osquery_3
 72  - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 73- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
 74
 75### False positive analysis
 76
 77- Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
 78- If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.
 79
 80### Response and remediation
 81
 82- Initiate the incident response process based on the outcome of the triage.
 83- Isolate the involved hosts to prevent further post-compromise behavior.
 84- 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.
 85- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 86- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 87- 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).
 88"""
 89risk_score = 47
 90rule_id = "291a0de9-937a-4189-94c0-3e847c8b13e4"
 91setup = """## Setup
 92
 93Audit Security Group Management must be enabled to generate the events used by this rule.
 94Setup instructions: https://ela.st/audit-security-group-management
 95"""
 96severity = "medium"
 97tags = [
 98    "Domain: Endpoint",
 99    "OS: Windows",
100    "Use Case: Threat Detection",
101    "Tactic: Discovery",
102    "Resources: Investigation Guide",
103    "Data Source: Windows Security Event Logs",
104    "Noise: Medium",
105    "Performance: Normal",
106    "Profile: Recommended",
107    "Threat: Ransomware",
108    "Rule Type: New Terms",
109    "Platform: Windows",
110    "Resources: Osquery",
111]
112timestamp_override = "event.ingested"
113type = "new_terms"
114
115query = '''
116host.os.type:windows and event.category:iam and event.action:user-member-enumerated and 
117  (
118    group.name:(*Admin* or "RemoteDesktopUsers") or
119    winlog.event_data.TargetSid:("S-1-5-32-544" or "S-1-5-32-555")
120  ) and 
121  not (
122    winlog.event_data.SubjectUserName: *$ or
123    winlog.event_data.SubjectUserSid: ("S-1-5-19" or "S-1-5-20") or 
124    winlog.event_data.CallerProcessName:("-" or 
125                                       C\:\\Windows\\System32\\VSSVC.exe or 
126                                       C\:\\Windows\\System32\\SearchIndexer.exe or 
127                                       C\:\\Windows\\System32\\CompatTelRunner.exe or 
128                                       C\:\\Windows\\System32\\oobe\\msoobe.exe or
129                                       C\:\\Windows\\System32\\net1.exe or 
130                                       C\:\\Windows\\System32\\svchost.exe or 
131                                       C\:\\Windows\\System32\\Netplwiz.exe or 
132                                       C\:\\Windows\\System32\\msiexec.exe or
133                                       C\:\\Windows\\System32\\CloudExperienceHostBroker.exe or
134                                       C\:\\Windows\\System32\\RuntimeBroker.exe or
135                                       C\:\\Windows\\System32\\wbem\\WmiPrvSE.exe or
136                                       C\:\\Windows\\System32\\SrTasks.exe or
137                                       C\:\\Windows\\System32\\diskshadow.exe or
138                                       C\:\\Windows\\System32\\dfsrs.exe or
139                                       C\:\\Windows\\System32\\vssadmin.exe or
140                                       C\:\\Windows\\System32\\dllhost.exe or
141                                       C\:\\Windows\\System32\\mmc.exe or
142                                       C\:\\Windows\\System32\\SettingSyncHost.exe or
143                                       C\:\\Windows\\System32\\inetsrv\\w3wp.exe or
144                                       C\:\\Windows\\System32\\wsmprovhost.exe or
145                                       C\:\\Windows\\System32\\mstsc.exe or
146                                       C\:\\Windows\\System32\\esentutl.exe or
147                                       C\:\\Windows\\System32\\RecoveryDrive.exe or
148                                       C\:\\Windows\\System32\\SystemPropertiesComputerName.exe or
149                                       C\:\\Windows\\SysWOW64\\msiexec.exe or
150                                       C\:\\Windows\\System32\\taskhostw.exe or
151                                       C\:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe or
152                                       C\:\\Windows\\Temp\\rubrik_vmware*\\snaptool.exe or
153                                       C\:\\Windows\\VeeamVssSupport\\VeeamGuestHelper.exe or
154                                       C\:\\WindowsAzure\\*WaAppAgent.exe or
155                                       C\:\\$WINDOWS.~BT\\Sources\\*.exe
156                                      )
157  )
158'''
159
160
161[[rule.filters]]
162
163[rule.filters.meta]
164negate = true
165[rule.filters.query.wildcard."winlog.event_data.CallerProcessName"]
166case_insensitive = true
167value = "C:\\\\Program Files (x86)\\\\*.exe"
168[[rule.filters]]
169
170[rule.filters.meta]
171negate = true
172[rule.filters.query.wildcard."winlog.event_data.CallerProcessName"]
173case_insensitive = true
174value = "C:\\\\Program Files\\\\*.exe"
175[[rule.threat]]
176framework = "MITRE ATT&CK"
177[[rule.threat.technique]]
178id = "T1069"
179name = "Permission Groups Discovery"
180reference = "https://attack.mitre.org/techniques/T1069/"
181[[rule.threat.technique.subtechnique]]
182id = "T1069.001"
183name = "Local Groups"
184reference = "https://attack.mitre.org/techniques/T1069/001/"
185
186
187
188[rule.threat.tactic]
189id = "TA0007"
190name = "Discovery"
191reference = "https://attack.mitre.org/tactics/TA0007/"
192
193[rule.new_terms]
194field = "new_terms_fields"
195value = ["winlog.event_data.CallerProcessName"]
196[[rule.new_terms.history_window_start]]
197field = "history_window_start"
198value = "now-5d"

Triage and analysis

Investigating Enumeration of Privileged Local Groups Membership

After successfully compromising an environment, attackers may try to gain situational awareness to plan their next steps. This can happen by running commands to enumerate network resources, users, connections, files, and installed security software.

This rule looks for the enumeration of privileged local groups' membership by suspicious processes, and excludes known legitimate utilities and programs installed. Attackers can use this information to decide the next steps of the attack, such as mapping targets for credential compromise and other post-exploitation activities.

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

  • Identify the process, host and user involved on the event.
  • 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.
  • Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
  • Examine the host for derived artifacts that indicate suspicious activities:
    • Analyze the process executable using a private sandboxed analysis system.
    • Observe and collect information about the following activities in both the sandbox and 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
    • Retrieve the files' SHA-256 hash values using the PowerShell Get-FileHash cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
  • Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.

False positive analysis

  • Discovery activities are not inherently malicious if they occur in isolation. As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
  • If this rule is noisy in your environment due to expected activity, consider adding exceptions — preferably with a combination of user and command line conditions.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts 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.
  • 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).

Related rules

to-top