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 = "2024/03/28"
  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.registry-*"]
 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"""
 61references = [
 62    "https://bohops.com/2018/08/18/abusing-the-com-registry-structure-part-2-loading-techniques-for-evasion-and-persistence/",
 63]
 64risk_score = 47
 65rule_id = "16a52c14-7883-47af-8745-9357803f0d4c"
 66setup = """## Setup
 67
 68If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 69events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 70Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 71`event.ingested` to @timestamp.
 72For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 73"""
 74severity = "medium"
 75tags = ["Domain: Endpoint", "OS: Windows", "Use Case: Threat Detection", "Tactic: Persistence", "Tactic: Defense Evasion", "Tactic: Privilege Escalation","Resources: Investigation Guide", "Data Source: Elastic Endgame", "Data Source: Elastic Defend"]
 76timestamp_override = "event.ingested"
 77type = "eql"
 78
 79query = '''
 80registry where host.os.type == "windows" and
 81  /* not necessary but good for filtering privileged installations */
 82  user.domain != "NT AUTHORITY" and
 83  (
 84    (
 85      registry.path : "HK*\\InprocServer32\\" and
 86      registry.data.strings: ("scrobj.dll", "?:\\*\\scrobj.dll") and
 87      not registry.path : "*\\{06290BD*-48AA-11D2-8432-006008C3FBFC}\\*"
 88    ) or
 89
 90    (
 91      registry.path : "HKLM\\*\\InProcServer32\\*" and
 92        registry.data.strings : ("*\\Users\\*", "*\\ProgramData\\*")
 93    ) or
 94
 95    /* in general COM Registry changes on Users Hive is less noisy and worth alerting */
 96    (
 97      registry.path : (
 98        "HKEY_USERS\\*\\InprocServer32\\",
 99        "HKEY_USERS\\*\\LocalServer32\\",
100        "HKEY_USERS\\*\\DelegateExecute",
101        "HKEY_USERS\\*\\TreatAs\\",
102        "HKEY_USERS\\*\\ScriptletURL*"
103      ) and
104      not 
105      (
106        (
107          process.name : "svchost.exe" and
108            process.code_signature.trusted == true and process.code_signature.subject_name == "Microsoft Windows Publisher" and
109            registry.value : "DelegateExecute" and
110            registry.data.strings : (
111              /* https://strontic.github.io/xcyclopedia/library/clsid_4ED3A719-CEA8-4BD9-910D-E252F997AFC2.html */
112              "{4ED3A719-CEA8-4BD9-910D-E252F997AFC2}",
113
114              /* https://strontic.github.io/xcyclopedia/library/clsid_A56A841F-E974-45C1-8001-7E3F8A085917.html */
115              "{A56A841F-E974-45C1-8001-7E3F8A085917}",
116
117              /* https://strontic.github.io/xcyclopedia/library/clsid_BFEC0C93-0B7D-4F2C-B09C-AFFFC4BDAE78.html */
118              "{BFEC0C93-0B7D-4F2C-B09C-AFFFC4BDAE78}",
119              "%SystemRoot%\\system32\\shdocvw.dll"
120            )
121        ) or
122        (
123          process.name : "veeam.backup.shell.exe" and
124            registry.path : "HKEY_USERS\\S-1-*_Classes\\CLSID\\*\\LocalServer32\\" and
125            process.code_signature.trusted == true and process.code_signature.subject_name == "Veeam Software Group GmbH"
126        ) or 
127        (
128          process.name : ("ADNotificationManager.exe", "Creative Cloud.exe") and
129            process.code_signature.trusted == true and process.code_signature.subject_name == "Adobe Inc." and
130            registry.data.strings : (
131              "\"?:\\Program Files (x86)\\Adobe\\Acrobat Reader DC\\Reader\\ADNotificationManager.exe\" -ToastActivated",
132              "\"?:\\Program Files (x86)\\Adobe\\Acrobat DC\\Acrobat\\ADNotificationManager.exe\" -ToastActivated",
133              "\"?:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\ADNotificationManager.exe\" -ToastActivated",
134              "\"?:\\Program Files\\Adobe\\Acrobat Reader DC\\Reader\\ADNotificationManager.exe\" -ToastActivated",
135              "\"?:\\Program Files\\Adobe\\Adobe Creative Cloud\\ACC\\Creative Cloud.exe\" -ToastActivated"
136            )
137        ) or 
138        (
139          process.name : ("IslandUpdateComRegisterShell64.exe", "IslandUpdate.exe", "GoogleUpdateComRegisterShell64.exe") and
140            process.code_signature.trusted == true and
141            process.code_signature.subject_name in ("Island Technology Inc.", "Google LLC") and
142            registry.data.strings : (
143              "*?:\\Users\\*\\AppData\\Local\\Island\\Update\\*",
144              "*?:\\Users\\*\\AppData\\Local\\Google\\Update\\*"
145            )
146        ) or 
147        (
148          process.name : ("SelfService.exe", "WfShell.exe") and
149            process.code_signature.trusted == true and process.code_signature.subject_name == "Citrix Systems, Inc." and
150            registry.data.strings : (
151              "\"?:\\Program Files (x86)\\Citrix\\ICA Client\\SelfServicePlugin\\SelfService.exe\" -ToastActivated",
152              "%SystemRoot%\\system32\\shdocvw.dll",
153              "%SystemRoot%\\sysWOW64\\shdocvw.dll"
154            )
155        ) or 
156        (
157          process.name : ("msrdcw.exe") and
158            process.code_signature.trusted == true and process.code_signature.subject_name == "Microsoft Corporation" and
159            registry.data.strings : (
160              "\"?:\\Program Files\\Remote Desktop\\msrdcw.exe\" -ToastActivated",
161              "\"?:\\Users\\*\\AppData\\Local\\Apps\\Remote Desktop\\msrdcw.exe\" -ToastActivated"
162            )
163        ) or 
164        (
165          process.name : ("ssvagent.exe") and
166            process.code_signature.trusted == true and process.code_signature.subject_name == "Oracle America, Inc." and
167            registry.data.strings : (
168              "?:\\Program Files\\Java\\jre*\\bin\\jp2iexp.dll",
169              "?:\\Program Files (x86)\\Java\\jre*\\bin\\jp2iexp.dll"
170            )
171        ) or 
172        (
173          process.name : ("hpnotifications.exe") and
174            process.code_signature.trusted == true and process.code_signature.subject_name == "HP Inc." and
175            registry.data.strings : (
176              "\"?:\\Windows\\System32\\DriverStore\\FileRepository\\hpsvcsscancomp.inf_amd64_*\\x64\\hpnotifications.exe\" -ToastActivated"
177            )
178        )
179      )
180    )
181  ) and
182
183  /* removes false-positives generated by OneDrive and Teams */
184  not
185  (
186    process.name: ("OneDrive.exe", "OneDriveSetup.exe", "FileSyncConfig.exe", "Teams.exe") and
187    process.code_signature.trusted == true and process.code_signature.subject_name in ("Microsoft Windows", "Microsoft Corporation")
188  ) and
189
190  /* Teams DLL loaded by regsvr */
191  not (process.name: "regsvr32.exe" and registry.data.strings : "*Microsoft.Teams.*.dll")
192'''
193
194
195[[rule.threat]]
196framework = "MITRE ATT&CK"
197[[rule.threat.technique]]
198id = "T1546"
199name = "Event Triggered Execution"
200reference = "https://attack.mitre.org/techniques/T1546/"
201[[rule.threat.technique.subtechnique]]
202id = "T1546.015"
203name = "Component Object Model Hijacking"
204reference = "https://attack.mitre.org/techniques/T1546/015/"
205
206
207
208[rule.threat.tactic]
209id = "TA0003"
210name = "Persistence"
211reference = "https://attack.mitre.org/tactics/TA0003/"
212
213[[rule.threat]]
214framework = "MITRE ATT&CK"
215[[rule.threat.technique]]
216id = "T1546"
217name = "Event Triggered Execution"
218reference = "https://attack.mitre.org/techniques/T1546/"
219[[rule.threat.technique.subtechnique]]
220id = "T1546.015"
221name = "Component Object Model Hijacking"
222reference = "https://attack.mitre.org/techniques/T1546/015/"
223
224
225
226[rule.threat.tactic]
227id = "TA0004"
228name = "Privilege Escalation"
229reference = "https://attack.mitre.org/tactics/TA0004/"
230
231
232
233[[rule.threat]]
234framework = "MITRE ATT&CK"
235[[rule.threat.technique]]
236id = "T1112"
237name = "Modify Registry"
238reference = "https://attack.mitre.org/techniques/T1112/"
239
240[rule.threat.tactic]
241id = "TA0005"
242name = "Defense Evasion"
243reference = "https://attack.mitre.org/tactics/TA0005/"

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.
    • 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.

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).

References

Related rules

to-top