Windows Registry Modification for Safe Mode Persistence
Adversaries modify SafeBoot registry keys to ensure malicious drivers or services execute during Safe Mode, enabling persistence and bypassing standard startup security.
Threat actors utilize modifications to Windows SafeBoot registry keys, specifically within the "Minimal" and "Network" subkeys, to maintain persistence on compromised systems. By injecting entries into these paths, attackers ensure that malicious drivers or services are authorized to execute even when the operating system is booted in Safe Mode. This technique is particularly effective at evading security solutions that rely on standard startup configurations or drivers that may be disabled during normal operation but remain active in Safe Mode. The "Network" key is specifically targeted to allow persistence while maintaining network connectivity for C2 communication. This behavior has been observed in ransomware operations where persistent access is required to facilitate full system encryption.
Attack Chain
- Attacker gains administrative privileges on the target Windows system.
- Attacker prepares a malicious driver or service binary to be executed.
- Attacker identifies the appropriate registry subkey under HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal or Network.
- Attacker modifies the registry to add a new service or driver entry referencing the malicious binary.
- Attacker forces a system reboot into Safe Mode.
- The Windows kernel initializes, reads the modified SafeBoot keys, and loads the attacker-controlled binary.
- The malicious code executes in the context of the boot process or during service initialization.
- Attacker achieves persistent command and control or data encryption capabilities despite security software restrictions.
Impact
Successful exploitation allows attackers to maintain persistence through reboots and circumvent traditional endpoint security controls that may not be fully initialized or active during Safe Mode. This facilitates long-term access, potential for lateral movement, and the execution of destructive actions like ransomware deployment. Observed activity has historically been linked to ransomware groups seeking to ensure their malicious payloads survive system hardening or recovery attempts.
Recommendation
- Deploy the provided Sigma rule to detect modifications to the SafeBoot registry hives.
- Implement strict access control lists (ACLs) on the HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot registry keys to prevent unauthorized write operations.
- Monitor endpoint registry activity using Sysmon Event ID 13 specifically targeting the SafeBoot paths.
- Audit installed drivers and services regularly to identify unsigned or suspicious binaries registered to load during system boot.
Immediate actions
Deploy Sigma rule to monitor HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot registry keys.
Threat Hunt
Search for any recent modifications to SafeBoot keys in registry audit logs.
Data: Sysmon Event ID 13
Detection coverage 1
Detect SafeBoot Registry Key Modification
highDetects modifications to the Windows SafeBoot registry keys which could indicate an attempt to achieve persistence in Safe Mode.
Detection queries are available on the platform. Get full rules →