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"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/02/27"
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 = """
38Identifies instances of an unusual process enumerating built-in Windows privileged local groups membership like
39Administrators or Remote Desktop users.
40"""
41from = "now-9m"
42index = ["winlogbeat-*", "logs-system.*", "logs-windows.*"]
43language = "eql"
44license = "Elastic License v2"
45name = "Enumeration of Privileged Local Groups Membership"
46note = """## Triage and analysis
47
48### Investigating Enumeration of Privileged Local Groups Membership
49
50After 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.
51
52This 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.
53
54> **Note**:
55> 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.
56
57#### Possible investigation steps
58
59- Identify the process, host and user involved on the event.
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- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
63- Examine the host for derived artifacts that indicate suspicious activities:
64 - Analyze the process executable using a private sandboxed analysis system.
65 - Observe and collect information about the following activities in both the sandbox and the alert subject host:
66 - Attempts to contact external domains and addresses.
67 - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
68 - Examine the DNS cache for suspicious or anomalous entries.
69 - $osquery_0
70 - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
71 - Examine the host services for suspicious or anomalous entries.
72 - $osquery_1
73 - $osquery_2
74 - $osquery_3
75 - 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.
76- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.
77
78### False positive analysis
79
80- 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.
81- 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.
82
83### Response and remediation
84
85- Initiate the incident response process based on the outcome of the triage.
86- Isolate the involved hosts to prevent further post-compromise behavior.
87- 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.
88- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
89- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
90- 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).
91
92## Setup
93
94The 'Audit Security Group Management' audit policy must be configured (Success).
95Steps to implement the logging policy with 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
4If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define `event.ingested` and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate `event.ingested` to @timestamp for this rule to work.
5"""
6risk_score = 47
7rule_id = "291a0de9-937a-4189-94c0-3e847c8b13e4"
8severity = "medium"
9tags = ["Elastic", "Host", "Windows", "Threat Detection", "Discovery", "Investigation Guide"]
10timestamp_override = "event.ingested"
11type = "eql"
12
13query = '''
14iam where host.os.type == "windows" and event.action == "user-member-enumerated" and
15
16 /* excluding machine account */
17 not winlog.event_data.SubjectUserName: ("*$", "LOCAL SERVICE", "NETWORK SERVICE") and
18
19 /* noisy and usual legit processes excluded */
20 not winlog.event_data.CallerProcessName:
21 ("-",
22 "?:\\Windows\\System32\\VSSVC.exe",
23 "?:\\Windows\\System32\\SearchIndexer.exe",
24 "?:\\Windows\\System32\\CompatTelRunner.exe",
25 "?:\\Windows\\System32\\oobe\\msoobe.exe",
26 "?:\\Windows\\System32\\net1.exe",
27 "?:\\Windows\\System32\\svchost.exe",
28 "?:\\Windows\\System32\\Netplwiz.exe",
29 "?:\\Windows\\System32\\msiexec.exe",
30 "?:\\Windows\\SysWOW64\\msiexec.exe",
31 "?:\\Windows\\System32\\CloudExperienceHostBroker.exe",
32 "?:\\Windows\\System32\\wbem\\WmiPrvSE.exe",
33 "?:\\Windows\\System32\\SrTasks.exe",
34 "?:\\Windows\\System32\\lsass.exe",
35 "?:\\Windows\\System32\\diskshadow.exe",
36 "?:\\Windows\\System32\\dfsrs.exe",
37 "?:\\Program Files\\*.exe",
38 "?:\\Program Files (x86)\\*.exe",
39 "?:\\WindowsAzure\\*\\WaAppAgent.exe",
40 "?:\\Windows\\System32\\vssadmin.exe",
41 "?:\\Windows\\VeeamVssSupport\\VeeamGuestHelper.exe",
42 "?:\\Windows\\System32\\dllhost.exe",
43 "?:\\Windows\\System32\\mmc.exe",
44 "?:\\Windows\\System32\\SettingSyncHost.exe",
45 "?:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
46 "?:\\Windows\\System32\\SystemSettingsAdminFlows.exe",
47 "?:\\Windows\\Temp\\rubrik_vmware???\\snaptool.exe",
48 "?:\\Windows\\System32\\inetsrv\\w3wp.exe",
49 "?:\\$WINDOWS.~BT\\Sources\\*.exe",
50 "?:\\Windows\\System32\\wsmprovhost.exe",
51 "?:\\Windows\\System32\\spool\\drivers\\x64\\3\\x3jobt3?.exe",
52 "?:\\Windows\\System32\\mstsc.exe",
53 "?:\\Windows\\System32\\esentutl.exe",
54 "?:\\Windows\\System32\\RecoveryDrive.exe",
55 "?:\\Windows\\System32\\SystemPropertiesComputerName.exe") and
56
57 /* privileged local groups */
58 (group.name:("*admin*","RemoteDesktopUsers") or
59 winlog.event_data.TargetSid:("S-1-5-32-544","S-1-5-32-555"))
60'''
61
62
63[[rule.threat]]
64framework = "MITRE ATT&CK"
65[[rule.threat.technique]]
66id = "T1069"
67name = "Permission Groups Discovery"
68reference = "https://attack.mitre.org/techniques/T1069/"
69[[rule.threat.technique.subtechnique]]
70id = "T1069.001"
71name = "Local Groups"
72reference = "https://attack.mitre.org/techniques/T1069/001/"
73
74
75
76[rule.threat.tactic]
77id = "TA0007"
78name = "Discovery"
79reference = "https://attack.mitre.org/tactics/TA0007/"
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).
Setup
The 'Audit Security Group Management' audit policy must be configured (Success). Steps to implement the logging policy with with Advanced Audit Configuration:
1Computer Configuration >
2Policies >
3Windows Settings >
4Security Settings >
5Advanced Audit Policies Configuration >
6Audit Policies >
7Account Management >
8Audit Security Group Management (Success)
Microsoft introduced the event used in this detection rule on Windows 10 and Windows Server 2016 or later operating systems.
If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2, events will not define event.ingested
and default fallback for EQL rules was not added until 8.2, so you will need to add a custom pipeline to populate event.ingested
to @timestamp for this rule to work.