Safe Mode Boot
Adversaries may abuse Windows safe mode to disable endpoint defenses. Safe mode starts up the Windows operating system with a limited set of drivers and services. Third-party security software such as endpoint detection and response (EDR) tools may not start after booting Windows in safe mode. There are two versions of safe mode: Safe Mode and Safe Mode with Networking. Adversaries may abuse safe mode to disable endpoint defenses that may not start with a limited boot. Hosts can be forced into safe mode after the next reboot via modifications to Boot Configuration Data (BCD) stores using bcdedit. Adversaries may also add their malicious applications to the list of minimal services that start in safe mode by modifying relevant Registry values. This technique has been used by multiple ransomware families including REvil, Black Basta, LockBit 3.0, AvosLocker, Qilin, and RansomHub to encrypt files while EDR tools are inactive.
What is T1688 Safe Mode Boot?
Safe Mode Boot (T1688) maps to the Defense Impairment tactic — the adversary is trying to break security mechanisms, pipelines, and tooling so defenders can’t see or trust what’s happening in MITRE ATT&CK.
This page provides production-ready detection logic for Safe Mode Boot, covering the data sources and telemetry it touches: Process: Process Creation, Command: Command Execution, Windows Registry: Windows Registry Key Modification, Microsoft Defender for Endpoint. The queries below are rated critical severity at high confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Tactic
- Defense Impairment
- Technique
- T1688 Safe Mode Boot
- Canonical reference
- https://attack.mitre.org/techniques/T1688/
let BcdEditSafeMode = dynamic([
"safeboot", "safebootalternateshell",
"{current}", "{default}"
]);
let SafeModeRegistryPaths = dynamic([
"SafeBoot\\Minimal",
"SafeBoot\\Network"
]);
union
(
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "bcdedit.exe"
| where ProcessCommandLine has_any ("safeboot", "/set", "network", "minimal")
| extend IsSafeBootSet = ProcessCommandLine has "safeboot"
| extend IsNetworkMode = ProcessCommandLine has "network"
| extend IsDeleteSafeBoot = ProcessCommandLine has "deletevalue" and ProcessCommandLine has "safeboot"
| project Timestamp, DeviceName, AccountName, FileName,
ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessCommandLine,
IsSafeBootSet, IsNetworkMode, IsDeleteSafeBoot
),
(
DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_any (SafeModeRegistryPaths)
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| project Timestamp, DeviceName, AccountName,
RegistryKey, RegistryValueName, RegistryValueData,
InitiatingProcessFileName, InitiatingProcessCommandLine,
ActionType
),
(
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "bootcfg.exe"
| where ProcessCommandLine has "/raw" and ProcessCommandLine has_any ("safeboot", "/SAFEBOOT")
| project Timestamp, DeviceName, AccountName, FileName,
ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessCommandLine
)
| sort by Timestamp desc Detects safe mode boot abuse through three vectors: (1) bcdedit.exe commands that set safeboot mode (minimal or network), (2) registry modifications to SafeBoot\Minimal or SafeBoot\Network keys to register malicious services that persist in safe mode, and (3) legacy bootcfg.exe commands. Covers the full ransomware kill chain pattern where adversaries configure safe mode boot, register their payload as a safe-mode service, and force a reboot to encrypt files while EDR is disabled.
Data Sources
Required Tables
False Positives
- System administrators using bcdedit to troubleshoot boot issues or configure safe mode for maintenance windows
- IT helpdesk technicians remotely booting endpoints into safe mode to remove stubborn malware or driver conflicts
- Software installers that register themselves under SafeBoot registry keys as a legitimate minimal service (rare but possible with driver installers)
- Windows Update or BIOS firmware updates that temporarily modify BCD settings during a planned update cycle
Sigma rule & cross-platform mapping
The detection logic for Safe Mode Boot (T1688) above is provided in a vendor-neutral
form so you can deploy it on any SIEM. The same logic is shipped here as native
KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the
following logsource:
logsource:
category: process_creation
product: windows Browse the community-maintained Sigma rules for this technique:
Platform-specific guides for T1688
References (6)
- https://attack.mitre.org/techniques/T1688/
- https://www.bleepingcomputer.com/news/security/revil-ransomware-has-a-new-windows-safe-mode-encryption-mode/
- https://news.sophos.com/en-us/2019/12/09/snatch-ransomware-reboots-pcs-into-safe-mode-to-bypass-protection/
- https://www.cyberark.com/resources/blog/cyberark-labs-from-safe-mode-to-domain-compromise
- https://www.cybereason.com/blog/medusalocker-ransomware
- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/bcdedit
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1 Enable Safe Mode with Networking via bcdedit
Expected signal: Sysmon Event ID 1: Process Create with Image=bcdedit.exe, CommandLine containing '/set {current} safeboot network'. Security Event ID 4688 (if command line auditing enabled). DeviceProcessEvents in MDE.
- Test 2 Register Service in Safe Mode via Registry
Expected signal: Sysmon Event ID 12: Registry Key Created for HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\df00tech-test-svc. Sysmon Event ID 13: Registry Value Set with TargetObject showing the key and Details='Service'. DeviceRegistryEvents in MDE.
- Test 3 Enable Minimal Safe Mode via bcdedit
Expected signal: Sysmon Event ID 1: Process Create with Image=bcdedit.exe, CommandLine containing '/set {current} safeboot minimal'. DeviceProcessEvents in MDE with FileName=bcdedit.exe.
- Test 4 Force Reboot After Safe Mode Configuration
Expected signal: Sysmon Event ID 1: Two process creation events — bcdedit.exe and shutdown.exe. System Event ID 1074: Shutdown initiated with reason 'df00tech safe mode test'. After reboot, System Event ID 6005/6006 showing safe mode startup.
Response Playbook
Triage
- Examine the full bcdedit command line — is it setting safeboot to 'network' or 'minimal'? Network mode is specifically favored by ransomware (REvil, Black Basta) because it allows network-based encryption.
- Identify the parent process — was bcdedit spawned by an expected administrative tool (cmd.exe from RMM, PowerShell from SCCM) or an unexpected binary (unknown .exe, script host, or a recently dropped executable)?
- Check for registry modifications to HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ or \Minimal\ — were any new service entries added that would allow a non-standard process to run in safe mode?
- Look for a pending reboot — check if shutdown.exe /r or restart-computer was executed shortly after the bcdedit command. Ransomware typically forces an immediate reboot.
- Check the user context — is this SYSTEM, a local admin, or a domain account? Ransomware often runs as SYSTEM after privilege escalation.
- Review recent file activity — look for mass file rename events (.encrypted, .locked, .basta extensions) or ransomware note creation (readme.txt, RECOVER-FILES.txt) on the same endpoint.
Containment
- IMMEDIATELY revert the BCD change before the system reboots: run 'bcdedit /deletevalue {current} safeboot' on the affected endpoint to prevent safe mode boot.
- If a reboot is imminent or has already occurred: isolate the endpoint from the network via EDR isolation or switch port shutdown to prevent lateral spread.
- If ransomware indicators are confirmed: trigger your ransomware response plan — isolate all endpoints in the same network segment and disable shared drive access.
- Block the initiating process hash across all endpoints via EDR global block rule.
- If the safe mode service registry key was modified: remove the malicious service entry from SafeBoot\Network and SafeBoot\Minimal before any reboot occurs.
Evidence Collection
- BCD store export: run 'bcdedit /enum all > bcd_export.txt' to capture the current boot configuration including any safeboot settings.
- Registry export: export HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal and SafeBoot\Network to identify any services added by the adversary.
- Process Creation Events — Sysmon Event ID 1 or Security Event ID 4688 for bcdedit.exe and any parent/child process chain.
- Sysmon Event ID 13 (Registry Value Set) — captures the exact registry modifications to SafeBoot keys with before/after values.
- File System Events — Sysmon Event ID 11 for any files dropped by the parent process of bcdedit (likely the ransomware payload).
- Scheduled Tasks — check for scheduled tasks created to run after reboot in safe mode (schtasks, at.exe, or WMI event subscriptions).
- Windows Event Log — System log Event ID 1074 (system shutdown/restart initiated) to confirm reboot timing.
Escalation Criteria
- ! bcdedit /set safeboot network followed by shutdown /r within minutes — this is the canonical ransomware safe mode encryption pattern.
- ! New service registered under SafeBoot\Network or SafeBoot\Minimal registry keys by a non-Windows binary — indicates malware persisting into safe mode.
- ! Multiple endpoints showing bcdedit safeboot commands within a short time window — indicates automated ransomware propagation across the network.
- ! Parent process of bcdedit is an unknown or recently created executable, especially one dropped in TEMP, AppData, or ProgramData directories.
- ! The endpoint has concurrent indicators: shadow copy deletion (vssadmin delete shadows), security tool termination, and safeboot configuration.
Investigation Guide
Forensic Artifacts
- >
BCD Store: C:\Boot\BCD — binary file, can be parsed with bcdedit /enum or third-party tools to check safeboot configuration. - >
Registry: HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\ — lists services that start in minimal safe mode. - >
Registry: HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ — lists services that start in safe mode with networking. - >
Event Log: System Event ID 1074 — records shutdown/restart requests with the initiating process and reason code. - >
Event Log: System Event ID 6006/6005 — records clean/dirty shutdown and startup, useful for confirming the reboot occurred. - >
Prefetch: C:\Windows\Prefetch\BCDEDIT.EXE-*.pf — execution timestamps for bcdedit. - >
Shimcache/Amcache: Evidence of bcdedit.exe execution even if prefetch is unavailable.
Tuning Guidance
Safe mode bcdedit modifications are rare in normal enterprise operations, making this a low-noise detection. The primary tuning need is excluding legitimate IT operations: (1) Allowlist specific RMM tools (ConnectWise, Datto, etc.) that may use bcdedit during remote troubleshooting — match on parent process path, not just name. (2) Correlate with your ITSM/ticketing system to auto-close alerts that correspond to an open maintenance ticket. (3) For the registry-based detection, exclude Windows servicing processes (services.exe, TiWorker.exe, TrustedInstaller.exe) which legitimately write to SafeBoot keys during updates. (4) Consider raising severity to CRITICAL if the bcdedit safeboot command is followed by shadow copy deletion (vssadmin delete shadows) or security service termination within the same process tree.
Hunting Queries
Hunt for the ransomware kill chain pattern: bcdedit safeboot configuration followed by a forced reboot within 30 minutes on the same device. This specific sequence is the hallmark of safe mode ransomware (REvil, Black Basta, LockBit 3.0, AvosLocker) and should be treated as critical if no maintenance ticket exists.
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "bcdedit.exe"
| where ProcessCommandLine has "safeboot"
| join kind=inner (
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "shutdown.exe" or ProcessCommandLine has "Restart-Computer"
) on DeviceName
| where Timestamp1 > Timestamp and datetime_diff('minute', Timestamp1, Timestamp) < 30
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, RebootCmd=ProcessCommandLine1, MinutesBetween=datetime_diff('minute', Timestamp1, Timestamp) index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 Image="*\\bcdedit.exe" CommandLine="*safeboot*"
| rename host as src_host, _time as bcdedit_time
| join src_host [
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 (Image="*\\shutdown.exe" OR CommandLine="*Restart-Computer*")
| rename host as src_host, _time as reboot_time
]
| where reboot_time > bcdedit_time
| eval MinutesBetween=round((reboot_time - bcdedit_time) / 60, 1)
| where MinutesBetween < 30
| table bcdedit_time, src_host, User, CommandLine, MinutesBetween Hunt for non-system processes creating or modifying SafeBoot registry keys. Legitimate modifications to SafeBoot keys are rare and typically performed only by Windows servicing components. Any user-mode process writing to these keys is highly suspicious and may indicate ransomware registering itself as a safe mode service.
DeviceRegistryEvents
| where Timestamp > ago(7d)
| where RegistryKey has "SafeBoot"
| where ActionType == "RegistryKeyCreated" or ActionType == "RegistryValueSet"
| where InitiatingProcessFileName !in~ ("services.exe", "svchost.exe", "TiWorker.exe", "TrustedInstaller.exe")
| project Timestamp, DeviceName, AccountName, RegistryKey, RegistryValueName, RegistryValueData, InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=12 OR EventCode=13
TargetObject="*SafeBoot*"
NOT (Image="*\\services.exe" OR Image="*\\svchost.exe" OR Image="*\\TiWorker.exe" OR Image="*\\TrustedInstaller.exe")
| table _time, host, User, Image, TargetObject, Details, EventCode
| sort - _time Hunt for unusual bcdedit usage patterns — repeated executions or execution across multiple devices from the same parent process or account. Ransomware that spreads laterally will show bcdedit being run by the same tool across many endpoints in a short time period.
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "bcdedit.exe"
| summarize Count=count(), Commands=make_set(ProcessCommandLine), Devices=dcount(DeviceName) by InitiatingProcessFileName, AccountName
| where Count > 2 or Devices > 1
| sort by Count desc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 Image="*\\bcdedit.exe"
| stats count as Count, values(CommandLine) as Commands, dc(host) as Devices by ParentImage, User
| where Count > 2 OR Devices > 1
| sort - Count Atomic Red Team Tests
Uses bcdedit to configure the next boot into safe mode with networking — the exact command used by REvil, Black Basta, and LockBit 3.0 ransomware. This modifies the BCD store but does NOT force a reboot, making it safe for testing. The cleanup command reverts the setting.
Command
bcdedit /set {current} safeboot network Cleanup
bcdedit /deletevalue {current} safeboot Expected Telemetry
Sysmon Event ID 1: Process Create with Image=bcdedit.exe, CommandLine containing '/set {current} safeboot network'. Security Event ID 4688 (if command line auditing enabled). DeviceProcessEvents in MDE.
Expected Detection
KQL: DeviceProcessEvents query matches on FileName=bcdedit.exe with ProcessCommandLine containing 'safeboot' and 'network'. IsSafeBootSet=true, IsNetworkMode=true. SPL: IsSafeBootSet=1, IsNetworkMode=1.
Creates a new registry key under SafeBoot\Network to register a test service that would start in safe mode with networking. This is the technique used by ransomware to ensure their encryption binary runs even in safe mode. The cleanup removes the key.
Command
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\df00tech-test-svc" /ve /t REG_SZ /d "Service" /f Cleanup
reg delete "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\df00tech-test-svc" /f Expected Telemetry
Sysmon Event ID 12: Registry Key Created for HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\df00tech-test-svc. Sysmon Event ID 13: Registry Value Set with TargetObject showing the key and Details='Service'. DeviceRegistryEvents in MDE.
Expected Detection
KQL: DeviceRegistryEvents query matches on RegistryKey containing 'SafeBoot\Network'. SPL: Sysmon EventCode 12/13 with TargetObject containing 'SafeBoot'.
Uses bcdedit to configure the next boot into minimal safe mode (no networking). Some ransomware variants use minimal mode when they have already staged the payload locally and do not need network access for encryption.
Command
bcdedit /set {current} safeboot minimal Cleanup
bcdedit /deletevalue {current} safeboot Expected Telemetry
Sysmon Event ID 1: Process Create with Image=bcdedit.exe, CommandLine containing '/set {current} safeboot minimal'. DeviceProcessEvents in MDE with FileName=bcdedit.exe.
Expected Detection
KQL: DeviceProcessEvents query matches on FileName=bcdedit.exe with 'safeboot' and 'minimal'. IsSafeBootSet=true. SPL: IsSafeBootSet=1, IsMinimalMode=1.
Combines the full ransomware kill chain: set safe mode with networking, then schedule an immediate forced reboot. WARNING: This WILL reboot the test system. Only run on isolated test machines. The cleanup reverts the BCD setting but must be run before or after reboot.
Command
bcdedit /set {current} safeboot network && shutdown /r /f /t 5 /c "df00tech safe mode test" Cleanup
bcdedit /deletevalue {current} safeboot Expected Telemetry
Sysmon Event ID 1: Two process creation events — bcdedit.exe and shutdown.exe. System Event ID 1074: Shutdown initiated with reason 'df00tech safe mode test'. After reboot, System Event ID 6005/6006 showing safe mode startup.
Expected Detection
KQL: Both DeviceProcessEvents queries fire — bcdedit safeboot and shutdown. Hunting query detects the bcdedit-then-reboot pattern within 30 minutes. SPL: Both process events detected.