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", "m365_defender", "sentinel_one_cloud_funnel"]
  4maturity = "production"
  5updated_date = "2024/10/15"
  6min_stack_version = "8.14.0"
  7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
  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-*", "logs-m365_defender.event-*", "logs-sentinel_one_cloud_funnel.*"]
 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"
 73severity = "low"
 74tags = [
 75    "Domain: Endpoint",
 76    "OS: Windows",
 77    "Use Case: Threat Detection",
 78    "Tactic: Defense Evasion",
 79    "Resources: Investigation Guide",
 80    "Data Source: Elastic Endgame",
 81    "Data Source: Elastic Defend",
 82    "Data Source: Sysmon",
 83    "Data Source: Microsoft Defender for Endpoint",
 84    "Data Source: SentinelOne",
 85]
 86timestamp_override = "event.ingested"
 87type = "eql"
 88
 89query = '''
 90registry where host.os.type == "windows" and event.type == "change" and registry.value : "Blob" and
 91  registry.path :
 92    (
 93      "HKLM\\Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
 94      "HKLM\\Software\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
 95      "HKLM\\Software\\Policies\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
 96      "HKLM\\Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
 97      "\\REGISTRY\\MACHINE\\Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
 98      "\\REGISTRY\\MACHINE\\Software\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
 99      "\\REGISTRY\\MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
100      "\\REGISTRY\\MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
101      "MACHINE\\Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
102      "MACHINE\\Software\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob",
103      "MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\Root\\Certificates\\*\\Blob",
104      "MACHINE\\Software\\Policies\\Microsoft\\SystemCertificates\\AuthRoot\\Certificates\\*\\Blob"
105    ) and
106  not process.executable : (
107          "?:\\ProgramData\\Lenovo\\Vantage\\Addins\\LenovoHardwareScanAddin\\*\\LdeApi.Server.exe",
108          "?:\\ProgramData\\Logishrd\\LogiOptionsPlus\\Plugins\\64\\certmgr.exe",
109          "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpDefenderCoreService.exe",
110          "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
111          "?:\\ProgramData\\Quest\\KACE\\modules\\clientidentifier\\clientidentifier.exe",
112          "?:\\ProgramData\\Sophos\\AutoUpdate\\Cache\\sophos_autoupdate1.dir\\SophosUpdate.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