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 = "2025/03/20"
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 = """
36Identifies instances of an unusual process enumerating built-in Windows privileged local groups membership like
37Administrators or Remote Desktop users.
38"""
39from = "now-9m"
40index = ["winlogbeat-*", "logs-system.security*", "logs-windows.forwarded*"]
41language = "kuery"
42license = "Elastic License v2"
43name = "Enumeration of Privileged Local Groups Membership"
44note = """## Triage and analysis
45
46### Investigating Enumeration of Privileged Local Groups Membership
47
48After 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.
49
50This 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.
51
52> **Note**:
53> 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.
54
55#### Possible investigation steps
56
57- Identify the process, host and user involved on the event.
58- 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.
59- Investigate other alerts associated with the user/host during the past 48 hours.
60- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
61- Examine the host for derived artifacts that indicate suspicious activities:
62 - Analyze the process executable using a private sandboxed analysis system.
63 - Observe and collect information about the following activities in both the sandbox and 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 - 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.
74- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
75
76### False positive analysis
77
78- 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.
79- 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.
80
81### Response and remediation
82
83- Initiate the incident response process based on the outcome of the triage.
84- Isolate the involved hosts to prevent further post-compromise behavior.
85- 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.
86- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
87- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
88- 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).
89"""
90risk_score = 47
91rule_id = "291a0de9-937a-4189-94c0-3e847c8b13e4"
92setup = """## Setup
93
94The 'Audit Security Group Management' audit policy must be configured (Success).
95Steps to implement the logging policy with Advanced Audit Configuration:
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policies Configuration > Audit Policies > Account Management > Audit Security Group Management (Success)
1
2Microsoft introduced the [event used](https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4799) in this detection rule on Windows 10 and Windows Server 2016 or later operating systems.
3"""
4severity = "medium"
5tags = [
6 "Domain: Endpoint",
7 "OS: Windows",
8 "Use Case: Threat Detection",
9 "Tactic: Discovery",
10 "Resources: Investigation Guide",
11 "Data Source: Windows Security Event Logs",
12]
13timestamp_override = "event.ingested"
14type = "new_terms"
15
16query = '''
17host.os.type:windows and event.category:iam and event.action:user-member-enumerated and
18 (
19 group.name:(*Admin* or "RemoteDesktopUsers") or
20 winlog.event_data.TargetSid:("S-1-5-32-544" or "S-1-5-32-555")
21 ) and
22 not (
23 winlog.event_data.SubjectUserName: *$ or
24 winlog.event_data.SubjectUserSid: ("S-1-5-19" or "S-1-5-20") or
25 winlog.event_data.CallerProcessName:("-" or
26 C\:\\Windows\\System32\\VSSVC.exe or
27 C\:\\Windows\\System32\\SearchIndexer.exe or
28 C\:\\Windows\\System32\\CompatTelRunner.exe or
29 C\:\\Windows\\System32\\oobe\\msoobe.exe or
30 C\:\\Windows\\System32\\net1.exe or
31 C\:\\Windows\\System32\\svchost.exe or
32 C\:\\Windows\\System32\\Netplwiz.exe or
33 C\:\\Windows\\System32\\msiexec.exe or
34 C\:\\Windows\\System32\\CloudExperienceHostBroker.exe or
35 C\:\\Windows\\System32\\RuntimeBroker.exe or
36 C\:\\Windows\\System32\\wbem\\WmiPrvSE.exe or
37 C\:\\Windows\\System32\\SrTasks.exe or
38 C\:\\Windows\\System32\\diskshadow.exe or
39 C\:\\Windows\\System32\\dfsrs.exe or
40 C\:\\Windows\\System32\\vssadmin.exe or
41 C\:\\Windows\\System32\\dllhost.exe or
42 C\:\\Windows\\System32\\mmc.exe or
43 C\:\\Windows\\System32\\SettingSyncHost.exe or
44 C\:\\Windows\\System32\\inetsrv\\w3wp.exe or
45 C\:\\Windows\\System32\\wsmprovhost.exe or
46 C\:\\Windows\\System32\\mstsc.exe or
47 C\:\\Windows\\System32\\esentutl.exe or
48 C\:\\Windows\\System32\\RecoveryDrive.exe or
49 C\:\\Windows\\System32\\SystemPropertiesComputerName.exe or
50 C\:\\Windows\\SysWOW64\\msiexec.exe or
51 C\:\\Windows\\System32\\taskhostw.exe or
52 C\:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe or
53 C\:\\Windows\\Temp\\rubrik_vmware*\\snaptool.exe or
54 C\:\\Windows\\VeeamVssSupport\\VeeamGuestHelper.exe or
55 C\:\\WindowsAzure\\*WaAppAgent.exe or
56 C\:\\$WINDOWS.~BT\\Sources\\*.exe
57 )
58 )
59'''
60
61
62[[rule.filters]]
63
64[rule.filters.meta]
65negate = true
66[rule.filters.query.wildcard."winlog.event_data.CallerProcessName"]
67case_insensitive = true
68value = "C:\\\\Program Files (x86)\\\\*.exe"
69[[rule.filters]]
70
71[rule.filters.meta]
72negate = true
73[rule.filters.query.wildcard."winlog.event_data.CallerProcessName"]
74case_insensitive = true
75value = "C:\\\\Program Files\\\\*.exe"
76[[rule.threat]]
77framework = "MITRE ATT&CK"
78[[rule.threat.technique]]
79id = "T1069"
80name = "Permission Groups Discovery"
81reference = "https://attack.mitre.org/techniques/T1069/"
82[[rule.threat.technique.subtechnique]]
83id = "T1069.001"
84name = "Local Groups"
85reference = "https://attack.mitre.org/techniques/T1069/001/"
86
87
88
89[rule.threat.tactic]
90id = "TA0007"
91name = "Discovery"
92reference = "https://attack.mitre.org/tactics/TA0007/"
93
94[rule.new_terms]
95field = "new_terms_fields"
96value = ["host.id", "winlog.event_data.SubjectUserName", "winlog.event_data.CallerProcessName"]
97[[rule.new_terms.history_window_start]]
98field = "history_window_start"
99value = "now-14d"
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 network events to determine domains and addresses contacted by the subject process by filtering by the process'
- 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
- Attempts to contact external domains and addresses.
- 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
- AdFind Command Activity
- Enumerating Domain Trusts via DSQUERY.EXE
- Enumerating Domain Trusts via NLTEST.EXE
- Enumeration of Administrator Accounts
- Group Policy Discovery via Microsoft GPResult Utility