Code Signing Policy Modification Through Built-in tools

Identifies attempts to disable/modify the code signing policy through system native utilities. Code signing provides authenticity on a program, and grants the user with the ability to check whether the program has been tampered with. By allowing the execution of unsigned or self-signed code, threat actors can craft and execute malicious code.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2023/01/31"
  3integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2026/09/18"
  6[transform]
  7[[transform.osquery]]
  8label = "Osquery - Retrieve All Non-Microsoft Drivers with Virustotal Link"
  9query = """
 10SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, class, description, directory, image,
 11issuer_name, manufacturer, service, signed, subject_name FROM drivers JOIN authenticode ON drivers.image =
 12authenticode.path JOIN hash ON drivers.image = hash.path WHERE NOT (provider == "Microsoft" AND signed == "1")
 13"""
 14
 15[[transform.osquery]]
 16label = "Osquery - Retrieve All Unsigned Drivers with Virustotal Link"
 17query = """
 18SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, class, description, directory, image,
 19issuer_name, manufacturer, service, signed, subject_name FROM drivers JOIN authenticode ON drivers.image =
 20authenticode.path JOIN hash ON drivers.image = hash.path WHERE signed == "0"
 21"""
 22
 23
 24[rule]
 25author = ["Elastic"]
 26description = """
 27Identifies attempts to disable/modify the code signing policy through system native utilities. Code signing provides
 28authenticity on a program, and grants the user with the ability to check whether the program has been tampered with. By
 29allowing the execution of unsigned or self-signed code, threat actors can craft and execute malicious code.
 30"""
 31from = "now-9m"
 32index = [
 33    "endgame-*",
 34    "logs-crowdstrike.fdr*",
 35    "logs-endpoint.events.process-*",
 36    "logs-m365_defender.event-*",
 37    "logs-sentinel_one_cloud_funnel.*",
 38    "logs-system.security*",
 39    "logs-windows.forwarded*",
 40    "logs-windows.sysmon_operational-*",
 41    "winlogbeat-*",
 42]
 43language = "eql"
 44license = "Elastic License v2"
 45name = "Code Signing Policy Modification Through Built-in tools"
 46note = """## Triage and analysis
 47
 48### Investigating Code Signing Policy Modification Through Built-in tools
 49
 50Windows Driver Signature Enforcement (DSE) is a security feature introduced by Microsoft to enforce that only signed drivers can be loaded and executed into the kernel (ring 0). This feature was introduced to prevent attackers from loading their malicious drivers on targets. If the driver has an invalid signature, the system will not allow it to be loaded.
 51
 52This protection is essential for maintaining the security of the system. However, attackers or even administrators can disable this feature and load untrusted drivers, as this can put the system at risk. Therefore, it is important to keep this feature enabled and only load drivers from trusted sources to ensure the integrity and security of the system.
 53
 54This rule identifies commands that can disable the Driver Signature Enforcement feature.
 55
 56> **Note**:
 57> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
 58
 59#### Possible investigation steps
 60
 61- Identify the user account that performed the action and whether it should perform this kind of action.
 62- 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.
 63- Investigate other alerts associated with the user/host during the past 48 hours.
 64- Use Osquery and endpoint driver events (`event.category = "driver"`) to investigate if suspicious drivers were loaded into the system after the command was executed.
 65  - $osquery_0
 66  - $osquery_1
 67- Identify the driver's `Device Name` and `Service Name`.
 68- Check for alerts from the rules specified in the `Related Rules` section.
 69
 70### False positive analysis
 71
 72- This activity should not happen legitimately. The security team should address any potential benign true positive (B-TP), as this configuration can put the user and the domain at risk.
 73
 74### Related Rules
 75
 76- First Time Seen Driver Loaded - df0fd41e-5590-4965-ad5e-cd079ec22fa9
 77- Untrusted Driver Loaded - d8ab1ec1-feeb-48b9-89e7-c12e189448aa
 78- Code Signing Policy Modification Through Registry - da7733b1-fe08-487e-b536-0a04c6d8b0cd
 79
 80### Response and remediation
 81
 82- Initiate the incident response process based on the outcome of the triage.
 83- Isolate the involved host to prevent further post-compromise behavior.
 84- Disable and uninstall all suspicious drivers found in the system. This can be done via Device Manager. (Note that this step may require you to boot the system into Safe Mode.)
 85- Remove the related services and registry keys found in the system. Note that the service will probably not stop if the driver is still installed.
 86  - This can be done via PowerShell `Remove-Service` cmdlet.
 87- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 88- Remove and block malicious artifacts identified during triage.
 89- Ensure that the Driver Signature Enforcement is enabled on the system.
 90- 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.
 91- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 92- 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).
 93"""
 94
 95setup = """## Setup
 96
 97This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
 98
 99Setup instructions: https://ela.st/install-elastic-defend
100
101### Additional data sources
102
103This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
104
105- [CrowdStrike](https://ela.st/crowdstrike-integration)
106- [Microsoft Defender XDR](https://ela.st/m365-defender)
107- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
108- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
109- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
110"""
111
112risk_score = 47
113rule_id = "b43570de-a908-4f7f-8bdb-b2df6ffd8c80"
114severity = "medium"
115tags = [
116    "Domain: Endpoint",
117    "OS: Windows",
118    "Use Case: Threat Detection",
119    "Tactic: Defense Evasion",
120    "Data Source: Elastic Endgame",
121    "Resources: Investigation Guide",
122    "Data Source: Elastic Defend",
123    "Data Source: Windows Security Event Logs",
124    "Data Source: Microsoft Defender XDR",
125    "Data Source: Sysmon",
126    "Data Source: SentinelOne",
127    "Data Source: Crowdstrike",
128    "Noise: Low",
129    "Performance: Normal",
130    "Rule Type: Event Correlation (EQL)",
131    "Platform: Windows",
132    "Resources: Osquery",
133]
134timestamp_override = "event.ingested"
135type = "eql"
136
137query = '''
138process where host.os.type == "windows" and event.type == "start" and
139  (process.name: "bcdedit.exe" or ?process.pe.original_file_name == "bcdedit.exe") and process.args: ("-set", "/set") and 
140  process.args: ("TESTSIGNING", "nointegritychecks", "loadoptions", "DISABLE_INTEGRITY_CHECKS")
141'''
142
143
144[[rule.threat]]
145framework = "MITRE ATT&CK"
146[[rule.threat.technique]]
147id = "T1553"
148name = "Subvert Trust Controls"
149reference = "https://attack.mitre.org/techniques/T1553/"
150[[rule.threat.technique.subtechnique]]
151id = "T1553.006"
152name = "Code Signing Policy Modification"
153reference = "https://attack.mitre.org/techniques/T1553/006/"
154
155
156
157[rule.threat.tactic]
158id = "TA0005"
159name = "Defense Evasion"
160reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Code Signing Policy Modification Through Built-in tools

Windows Driver Signature Enforcement (DSE) is a security feature introduced by Microsoft to enforce that only signed drivers can be loaded and executed into the kernel (ring 0). This feature was introduced to prevent attackers from loading their malicious drivers on targets. If the driver has an invalid signature, the system will not allow it to be loaded.

This protection is essential for maintaining the security of the system. However, attackers or even administrators can disable this feature and load untrusted drivers, as this can put the system at risk. Therefore, it is important to keep this feature enabled and only load drivers from trusted sources to ensure the integrity and security of the system.

This rule identifies commands that can disable the Driver Signature Enforcement feature.

Note: This investigation guide uses the Osquery Markdown Plugin introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

Possible investigation steps

  • Identify the user account that performed the action and whether it should perform this kind of action.
  • 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.
  • Use Osquery and endpoint driver events (event.category = "driver") to investigate if suspicious drivers were loaded into the system after the command was executed.
    • $osquery_0
    • $osquery_1
  • Identify the driver's Device Name and Service Name.
  • Check for alerts from the rules specified in the Related Rules section.

False positive analysis

  • This activity should not happen legitimately. The security team should address any potential benign true positive (B-TP), as this configuration can put the user and the domain at risk.
  • First Time Seen Driver Loaded - df0fd41e-5590-4965-ad5e-cd079ec22fa9
  • Untrusted Driver Loaded - d8ab1ec1-feeb-48b9-89e7-c12e189448aa
  • Code Signing Policy Modification Through Registry - da7733b1-fe08-487e-b536-0a04c6d8b0cd

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.
  • Disable and uninstall all suspicious drivers found in the system. This can be done via Device Manager. (Note that this step may require you to boot the system into Safe Mode.)
  • Remove the related services and registry keys found in the system. Note that the service will probably not stop if the driver is still installed.
    • This can be done via PowerShell Remove-Service cmdlet.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Remove and block malicious artifacts identified during triage.
  • Ensure that the Driver Signature Enforcement is enabled on the system.
  • 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).

Related rules

to-top