Component Object Model Hijacking
Identifies Component Object Model (COM) hijacking via registry modification. Adversaries may establish persistence by executing malicious content triggered by hijacked references to COM objects.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/11/18"
3integration = ["endpoint"]
4maturity = "production"
5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
6min_stack_version = "8.3.0"
7updated_date = "2023/06/22"
8
9[rule]
10author = ["Elastic"]
11description = """
12Identifies Component Object Model (COM) hijacking via registry modification. Adversaries may establish persistence by
13executing malicious content triggered by hijacked references to COM objects.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.*", "endgame-*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Component Object Model Hijacking"
20note = """## Triage and analysis
21
22### Investigating Component Object Model Hijacking
23
24Adversaries can insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means of persistence.
25
26#### Possible investigation steps
27
28- 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.
29- Identify the user account that performed the action and whether it should perform this kind of action.
30- Investigate other alerts associated with the user/host during the past 48 hours.
31- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
32- Retrieve the file referenced in the registry and determine if it is malicious:
33 - Use a private sandboxed malware analysis system to perform analysis.
34 - Observe and collect information about the following activities:
35 - Attempts to contact external domains and addresses.
36 - File and registry access, modification, and creation activities.
37 - Service creation and launch activities.
38 - Scheduled task creation.
39 - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
40 - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
41
42### False positive analysis
43
44- Some Microsoft executables will reference the LocalServer32 registry key value for the location of external COM objects.
45
46### Response and remediation
47
48- Initiate the incident response process based on the outcome of the triage.
49- Isolate the involved host to prevent further post-compromise behavior.
50- If the triage identified malware, search the environment for additional compromised hosts.
51 - Implement temporary network rules, procedures, and segmentation to contain the malware.
52 - Stop suspicious processes.
53 - Immediately block the identified indicators of compromise (IoCs).
54 - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
55- Remove and block malicious artifacts identified during triage.
56- 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.
57- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
58- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
59- 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).
60
61
62## Setup
63
64If 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.
65"""
66references = [
67 "https://bohops.com/2018/08/18/abusing-the-com-registry-structure-part-2-loading-techniques-for-evasion-and-persistence/",
68]
69risk_score = 47
70rule_id = "16a52c14-7883-47af-8745-9357803f0d4c"
71severity = "medium"
72tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Persistence", "Resources: Investigation Guide", "Data Source: Elastic Endgame", "Data Source: Elastic Defend"]
73timestamp_override = "event.ingested"
74type = "eql"
75
76query = '''
77registry where host.os.type == "windows" and
78 /* not necessary but good for filtering privileged installations */
79 user.domain != "NT AUTHORITY" and
80 (
81 (
82 registry.path : ("HK*\\InprocServer32\\", "\\REGISTRY\\*\\InprocServer32\\") and
83 registry.data.strings: ("scrobj.dll", "C:\\*\\scrobj.dll") and
84 not registry.path : "*\\{06290BD*-48AA-11D2-8432-006008C3FBFC}\\*"
85 ) or
86
87 /* in general COM Registry changes on Users Hive is less noisy and worth alerting */
88 (registry.path : (
89 "HKEY_USERS\\*\\InprocServer32\\",
90 "HKEY_USERS\\*\\LocalServer32\\",
91 "HKEY_USERS\\*\\DelegateExecute*",
92 "HKEY_USERS\\*\\TreatAs*",
93 "HKEY_USERS\\*\\ScriptletURL*",
94 "\\REGISTRY\\USER\\*\\InprocServer32\\",
95 "\\REGISTRY\\USER\\*\\LocalServer32\\",
96 "\\REGISTRY\\USER\\*\\DelegateExecute*",
97 "\\REGISTRY\\USER\\*\\TreatAs*",
98 "\\REGISTRY\\USER\\*\\ScriptletURL*"
99 ) and not
100 (
101 process.executable : "?:\\Program Files*\\Veeam\\Backup and Replication\\Console\\veeam.backup.shell.exe" and
102 registry.path : (
103 "HKEY_USERS\\S-1-*_Classes\\CLSID\\*\\LocalServer32\\",
104 "\\REGISTRY\\USER\\S-1-*_Classes\\CLSID\\*\\LocalServer32\\"))
105 ) or
106
107 (
108 registry.path : ("HKLM\\*\\InProcServer32\\*", "\\REGISTRY\\MACHINE\\*\\InProcServer32\\*") and
109 registry.data.strings : ("*\\Users\\*", "*\\ProgramData\\*")
110 )
111 ) and
112
113 /* removes false-positives generated by OneDrive and Teams */
114 not process.name: ("OneDrive.exe", "OneDriveSetup.exe", "FileSyncConfig.exe", "Teams.exe") and
115
116 /* Teams DLL loaded by regsvr */
117 not (process.name: "regsvr32.exe" and registry.data.strings : "*Microsoft.Teams.*.dll")
118'''
119
120
121[[rule.threat]]
122framework = "MITRE ATT&CK"
123[[rule.threat.technique]]
124id = "T1546"
125name = "Event Triggered Execution"
126reference = "https://attack.mitre.org/techniques/T1546/"
127[[rule.threat.technique.subtechnique]]
128id = "T1546.015"
129name = "Component Object Model Hijacking"
130reference = "https://attack.mitre.org/techniques/T1546/015/"
131
132
133
134[rule.threat.tactic]
135id = "TA0003"
136name = "Persistence"
137reference = "https://attack.mitre.org/tactics/TA0003/"
Triage and analysis
Investigating Component Object Model Hijacking
Adversaries can insert malicious code that can be executed in place of legitimate software through hijacking the COM references and relationships as a means of persistence.
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.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
- Retrieve the file referenced in the registry and determine if it is malicious:
- Use a private sandboxed malware analysis system to perform analysis.
- Observe and collect information about the following activities:
- Attempts to contact external domains and addresses.
- File and registry access, modification, and creation activities.
- Service creation and launch activities.
- Scheduled task creation.
- Observe and collect information about the following activities:
- Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
- Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Use a private sandboxed malware analysis system to perform analysis.
False positive analysis
- Some Microsoft executables will reference the LocalServer32 registry key value for the location of external COM objects.
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.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- 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
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.
References
Related rules
- Adobe Hijack Persistence
- Creation of a Hidden Local User Account
- Execution via MSSQL xp_cmdshell Stored Procedure
- Persistence via Update Orchestrator Service Hijack
- Potential Modification of Accessibility Binaries