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"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies Component Object Model (COM) hijacking via registry modification. Adversaries may establish persistence by
 11executing malicious content triggered by hijacked references to COM objects.
 12"""
 13from = "now-9m"
 14index = ["logs-endpoint.events.registry-*"]
 15language = "eql"
 16license = "Elastic License v2"
 17name = "Component Object Model Hijacking"
 18note = """## Triage and analysis
 19
 20### Investigating Component Object Model Hijacking
 21
 22Adversaries 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.
 23
 24#### Possible investigation steps
 25
 26- 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.
 27- Identify the user account that performed the action and whether it should perform this kind of action.
 28- Investigate other alerts associated with the user/host during the past 48 hours.
 29- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.
 30- Retrieve the file referenced in the registry and determine if it is malicious:
 31  - Use a private sandboxed malware analysis system to perform analysis.
 32    - Observe and collect information about the following activities:
 33      - Attempts to contact external domains and addresses.
 34      - File and registry access, modification, and creation activities.
 35      - Service creation and launch activities.
 36      - Scheduled task creation.
 37  - Use the PowerShell Get-FileHash cmdlet to get the files' SHA-256 hash values.
 38    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 39
 40### False positive analysis
 41
 42- Some Microsoft executables will reference the LocalServer32 registry key value for the location of external COM objects.
 43
 44### Response and remediation
 45
 46- Initiate the incident response process based on the outcome of the triage.
 47- Isolate the involved host to prevent further post-compromise behavior.
 48- If the triage identified malware, search the environment for additional compromised hosts.
 49  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 50  - Stop suspicious processes.
 51  - Immediately block the identified indicators of compromise (IoCs).
 52  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 53- Remove and block malicious artifacts identified during triage.
 54- 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.
 55- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 56- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 57- 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).
 58"""
 59references = [
 60    "https://bohops.com/2018/08/18/abusing-the-com-registry-structure-part-2-loading-techniques-for-evasion-and-persistence/",
 61]
 62risk_score = 47
 63rule_id = "16a52c14-7883-47af-8745-9357803f0d4c"
 64setup = """## Setup
 65
 66If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 67events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 68Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 69`event.ingested` to @timestamp.
 70For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 71"""
 72severity = "medium"
 73tags = [
 74    "Domain: Endpoint",
 75    "OS: Windows",
 76    "Use Case: Threat Detection",
 77    "Tactic: Persistence",
 78    "Tactic: Defense Evasion",
 79    "Tactic: Privilege Escalation",
 80    "Resources: Investigation Guide",
 81    "Data Source: Elastic Endgame",
 82    "Data Source: Elastic Defend",
 83]
 84timestamp_override = "event.ingested"
 85type = "eql"
 86
 87query = '''
 88registry where host.os.type == "windows" and
 89  /* not necessary but good for filtering privileged installations */
 90  user.domain != "NT AUTHORITY" and process.executable != null and 
 91  (
 92    (
 93      registry.path : "HK*\\InprocServer32\\" and
 94      registry.data.strings: ("scrobj.dll", "?:\\*\\scrobj.dll") and
 95      not registry.path : "*\\{06290BD*-48AA-11D2-8432-006008C3FBFC}\\*"
 96    ) or
 97
 98    (
 99      registry.path : "HKLM\\*\\InProcServer32\\*" and
100        registry.data.strings : ("*\\Users\\*", "*\\ProgramData\\*")
101    ) or
102
103    /* in general COM Registry changes on Users Hive is less noisy and worth alerting */
104    (
105      registry.path : (
106        "HKEY_USERS\\*\\InprocServer32\\",
107        "HKEY_USERS\\*\\LocalServer32\\",
108        "HKEY_USERS\\*\\DelegateExecute",
109        "HKEY_USERS\\*\\TreatAs\\",
110        "HKEY_USERS\\*\\ScriptletURL*"
111      )  
112    )
113  ) and 
114
115      not  (
116            process.code_signature.trusted == true and
117            process.code_signature.subject_name in 
118                         ("Island Technology Inc.", "Google LLC", "Grammarly, Inc.", "Dropbox, Inc", "REFINITIV US LLC", "HP Inc.",
119                          "Citrix Systems, Inc.", "Adobe Inc.", "Veeam Software Group GmbH", "Zhuhai Kingsoft Office Software Co., Ltd.",
120                          "Oracle America, Inc.")
121        ) and 
122
123  /* excludes Microsoft signed noisy processes */
124  not
125  (
126    process.name : ("OneDrive.exe", "OneDriveSetup.exe", "FileSyncConfig.exe", "Teams.exe", "MicrosoftEdgeUpdate.exe", "msrdcw.exe", "MicrosoftEdgeUpdateComRegisterShell64.exe") and
127    process.code_signature.trusted == true and process.code_signature.subject_name in ("Microsoft Windows", "Microsoft Corporation")
128  ) and
129  
130  not process.executable : 
131                  ("?:\\Program Files (x86)\\*.exe", 
132                   "?:\\Program Files\\*.exe",
133                   "?:\\Windows\\System32\\svchost.exe", 
134                   "?:\\Windows\\System32\\msiexec.exe", 
135                   "?:\\Windows\\SysWOW64\\regsvr32.exe",
136                   "?:\\Windows\\System32\\regsvr32.exe",
137                   "?:\\Windows\\System32\\DriverStore\\FileRepository\\*.exe", 
138                   "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe")
139'''
140
141
142[[rule.threat]]
143framework = "MITRE ATT&CK"
144[[rule.threat.technique]]
145id = "T1546"
146name = "Event Triggered Execution"
147reference = "https://attack.mitre.org/techniques/T1546/"
148[[rule.threat.technique.subtechnique]]
149id = "T1546.015"
150name = "Component Object Model Hijacking"
151reference = "https://attack.mitre.org/techniques/T1546/015/"
152
153
154
155[rule.threat.tactic]
156id = "TA0003"
157name = "Persistence"
158reference = "https://attack.mitre.org/tactics/TA0003/"
159[[rule.threat]]
160framework = "MITRE ATT&CK"
161[[rule.threat.technique]]
162id = "T1546"
163name = "Event Triggered Execution"
164reference = "https://attack.mitre.org/techniques/T1546/"
165[[rule.threat.technique.subtechnique]]
166id = "T1546.015"
167name = "Component Object Model Hijacking"
168reference = "https://attack.mitre.org/techniques/T1546/015/"
169
170
171
172[rule.threat.tactic]
173id = "TA0004"
174name = "Privilege Escalation"
175reference = "https://attack.mitre.org/tactics/TA0004/"
176[[rule.threat]]
177framework = "MITRE ATT&CK"
178[[rule.threat.technique]]
179id = "T1112"
180name = "Modify Registry"
181reference = "https://attack.mitre.org/techniques/T1112/"
182
183
184[rule.threat.tactic]
185id = "TA0005"
186name = "Defense Evasion"
187reference = "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