Creation or Modification of Root Certificate

Identifies the creation or modification of a local trusted root certificate in Windows. The install of a malicious root certificate would allow an attacker the ability to masquerade malicious files as valid signed components from any entity (for example, Microsoft). It could also allow an attacker to decrypt SSL traffic.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/02/01"
  3integration = ["endpoint", "windows"]
  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 the creation or modification of a local trusted root certificate in Windows. The install of a malicious root
 13certificate would allow an attacker the ability to masquerade malicious files as valid signed components from any entity
 14(for example, Microsoft). It could also allow an attacker to decrypt SSL traffic.
 15"""
 16false_positives = ["Certain applications may install root certificates for the purpose of inspecting SSL traffic."]
 17from = "now-9m"
 18index = ["winlogbeat-*", "logs-endpoint.events.registry-*", "logs-windows.sysmon_operational-*", "endgame-*"]
 19language = "eql"
 20license = "Elastic License v2"
 21name = "Creation or Modification of Root Certificate"
 22note = """## Triage and analysis
 23
 24### Investigating Creation or Modification of Root Certificate
 25
 26Root certificates are the primary level of certifications that tell a browser that the communication is trusted and legitimate. This verification is based upon the identification of a certification authority. Windows adds several trusted root certificates so browsers can use them to communicate with websites.
 27
 28[Check out this post](https://www.thewindowsclub.com/what-are-root-certificates-windows) for more details on root certificates and the involved cryptography.
 29
 30This rule identifies the creation or modification of a root certificate by monitoring registry modifications. The installation of a malicious root certificate would allow an attacker the ability to masquerade malicious files as valid signed components from any entity (for example, Microsoft). It could also allow an attacker to decrypt SSL traffic.
 31
 32#### Possible investigation steps
 33
 34- 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.
 35- Investigate other alerts associated with the user/host during the past 48 hours.
 36- Investigate abnormal behaviors observed by the subject process such as network connections, other registry or file modifications, and any spawned child processes.
 37- If one of the processes is suspicious, retrieve it and determine if it is malicious:
 38  - Use a private sandboxed malware analysis system to perform analysis.
 39    - Observe and collect information about the following activities:
 40      - Attempts to contact external domains and addresses.
 41      - File and registry access, modification, and creation activities.
 42      - Service creation and launch activities.
 43      - Scheduled task creation.
 44  - Use the PowerShell `Get-FileHash` cmdlet to get the files' SHA-256 hash values.
 45    - Search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
 46
 47### False positive analysis
 48
 49- This detection may be triggered by certain applications that install root certificates for the purpose of inspecting SSL traffic. Benign true positives (B-TPs) can be added as exceptions if necessary.
 50
 51### Response and remediation
 52
 53- Initiate the incident response process based on the outcome of the triage.
 54- Isolate the involved host to prevent further post-compromise behavior.
 55- If the triage identified malware, search the environment for additional compromised hosts.
 56  - Implement temporary network rules, procedures, and segmentation to contain the malware.
 57  - Stop suspicious processes.
 58  - Immediately block the identified indicators of compromise (IoCs).
 59  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
 60- Remove the malicious certificate from the root certificate store.
 61- Remove and block malicious artifacts identified during triage.
 62- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 63- 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.
 64- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 65- 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).
 66"""
 67references = [
 68    "https://posts.specterops.io/code-signing-certificate-cloning-attacks-and-defenses-6f98657fc6ec",
 69    "https://www.ired.team/offensive-security/persistence/t1130-install-root-certificate",
 70]
 71risk_score = 21
 72rule_id = "203ab79b-239b-4aa5-8e54-fc50623ee8e4"
 73setup = """## Setup
 74
 75If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 76events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 77Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 78`event.ingested` to @timestamp.
 79For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 80"""
 81severity = "low"
 82tags = [
 83    "Domain: Endpoint",
 84    "OS: Windows",
 85    "Use Case: Threat Detection",
 86    "Tactic: Defense Evasion",
 87    "Resources: Investigation Guide",
 88    "Data Source: Elastic Endgame",
 89    "Data Source: Elastic Defend",
 90    "Data Source: Sysmon"
 91]
 92timestamp_override = "event.ingested"
 93type = "eql"
 94
 95query = '''
 96registry where host.os.type == "windows" and event.type in ("creation", "change") and
 97  registry.path :
 98    (
 99      "HKLM\\Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
100      "HKLM\\Software\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
101      "HKLM\\Software\\Policies\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
102      "HKLM\\Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
103      "\\REGISTRY\\MACHINE\\Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
104      "\\REGISTRY\\MACHINE\\Software\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
105      "\\REGISTRY\\MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
106      "\\REGISTRY\\MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob"
107    ) and
108  not process.executable : (
109          "?:\\ProgramData\\Lenovo\\Vantage\\Addins\\LenovoHardwareScanAddin\\*\\LdeApi.Server.exe",
110          "?:\\ProgramData\\Logishrd\\LogiOptionsPlus\\Plugins\\64\\certmgr.exe",
111          "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
112          "?:\\ProgramData\\Quest\\KACE\\modules\\clientidentifier\\clientidentifier.exe",
113          "?:\\Program Files (x86)\\*.exe",
114          "?:\\Program Files\\*.exe",
115          "?:\\Windows\\CCM\\CcmExec.exe",
116          "?:\\Windows\\ccmsetup\\cache\\ccmsetup.exe",
117          "?:\\Windows\\Cluster\\clussvc.exe",
118          "?:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
119          "?:\\Windows\\Lenovo\\ImController\\PluginHost86\\Lenovo.Modern.ImController.PluginHost.Device.exe",
120          "?:\\Windows\\Lenovo\\ImController\\Service\\Lenovo.Modern.ImController.exe",
121          "?:\\Windows\\Sysmon.exe",
122          "?:\\Windows\\Sysmon64.exe",
123          "?:\\Windows\\System32\\*.exe",
124          "?:\\Windows\\SysWOW64\\*.exe",
125          "?:\\Windows\\UUS\\amd64\\MoUsoCoreWorker.exe",
126          "?:\\Windows\\WinSxS\\*.exe"
127  )
128'''
129
130
131[[rule.threat]]
132framework = "MITRE ATT&CK"
133[[rule.threat.technique]]
134id = "T1553"
135name = "Subvert Trust Controls"
136reference = "https://attack.mitre.org/techniques/T1553/"
137[[rule.threat.technique.subtechnique]]
138id = "T1553.004"
139name = "Install Root Certificate"
140reference = "https://attack.mitre.org/techniques/T1553/004/"
141
142
143
144[rule.threat.tactic]
145id = "TA0005"
146name = "Defense Evasion"
147reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Creation or Modification of Root Certificate

Root certificates are the primary level of certifications that tell a browser that the communication is trusted and legitimate. This verification is based upon the identification of a certification authority. Windows adds several trusted root certificates so browsers can use them to communicate with websites.

Check out this post for more details on root certificates and the involved cryptography.

This rule identifies the creation or modification of a root certificate by monitoring registry modifications. The installation of a malicious root certificate would allow an attacker the ability to masquerade malicious files as valid signed components from any entity (for example, Microsoft). It could also allow an attacker to decrypt SSL traffic.

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.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate abnormal behaviors observed by the subject process such as network connections, other registry or file modifications, and any spawned child processes.
  • If one of the processes is suspicious, retrieve it 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

  • This detection may be triggered by certain applications that install root certificates for the purpose of inspecting SSL traffic. Benign true positives (B-TPs) can be added as exceptions if necessary.

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 the malicious certificate from the root certificate store.
  • Remove and block malicious artifacts identified during triage.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • 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.
  • 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