System Shutdown/Reboot
Adversaries may shutdown or reboot systems to interrupt access to, or aid in the destruction of, those systems. Shutdown and reboot commands exist across all major operating systems and may be invoked locally or remotely. Adversaries commonly pair T1529 with destructive techniques such as disk wiping (T1561) or inhibiting system recovery (T1490) to force destructive effects to take hold after reboot renders the system unbootable. Windows API functions including ExitWindowsEx, InitiateSystemShutdown, NtRaiseHardError, and ZwRaiseHardError are abused to programmatically force shutdowns or trigger blue screens of death (BSOD). Observed extensively in destructive malware: LockerGoga, Olympic Destroyer, WhisperGate (ExitWindowsEx with EWX_SHUTDOWN), AcidRain, AcidPour, Apostle, DCSrv, MultiLayer Wiper, BFG Agonizer (NtRaiseHardError BSOD), and Qilin ransomware targeting backup servers.
What is T1529 System Shutdown/Reboot?
System Shutdown/Reboot (T1529) maps to the Impact tactic — the adversary is trying to manipulate, interrupt, or destroy your systems and data in MITRE ATT&CK.
This page provides production-ready detection logic for System Shutdown/Reboot, covering the data sources and telemetry it touches: Process: Process Creation, Command: Command Execution, Microsoft Defender for Endpoint. The queries below are rated high severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.
MITRE ATT&CK
- Tactic
- Impact
- Technique
- T1529 System Shutdown/Reboot
- Canonical reference
- https://attack.mitre.org/techniques/T1529/
let SuspiciousParents = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "regsvr32.exe", "rundll32.exe", "msiexec.exe"]);
// Branch 1: Windows shutdown.exe
let WindowsShutdown = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "shutdown.exe"
| where ProcessCommandLine has_any ("/s", "/r", "-s", "-r")
| extend ImmediateShutdown = ProcessCommandLine has "/t 0" or ProcessCommandLine has "-t 0"
| extend ForcedShutdown = ProcessCommandLine has "/f" or ProcessCommandLine has "-f"
| extend RemoteShutdown = ProcessCommandLine has "/m"
| extend SuspiciousParent = InitiatingProcessFileName in~ (SuspiciousParents)
| extend RiskScore = toint(ImmediateShutdown) + toint(ForcedShutdown) + toint(SuspiciousParent) * 2
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
ImmediateShutdown, ForcedShutdown, RemoteShutdown, SuspiciousParent, RiskScore,
DetectionBranch="WindowsShutdownExe";
// Branch 2: PowerShell Windows API abuse (ExitWindowsEx, NtRaiseHardError)
let PowerShellAPIAbuse = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any (
"ExitWindowsEx", "InitiateSystemShutdown", "InitializeSystemShutdownExW",
"NtRaiseHardError", "ZwRaiseHardError",
"EWX_SHUTDOWN", "EWX_REBOOT", "EWX_POWEROFF",
"OptionShutdownSystem", "SeShutdownPrivilege"
)
| extend ImmediateShutdown = true
| extend ForcedShutdown = true
| extend RemoteShutdown = false
| extend SuspiciousParent = true
| extend RiskScore = 4
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
ImmediateShutdown, ForcedShutdown, RemoteShutdown, SuspiciousParent, RiskScore,
DetectionBranch="PowerShellAPIAbuse";
// Branch 3: Linux/macOS shutdown utilities
let LinuxMacShutdown = DeviceProcessEvents
| where Timestamp > ago(24h)
| where (
(FileName in~ ("shutdown", "reboot", "halt", "poweroff"))
or (FileName =~ "systemctl" and ProcessCommandLine has_any ("poweroff", "reboot", "halt", "shutdown"))
or (FileName =~ "init" and ProcessCommandLine matches regex @"\s[06]$")
)
| where DeviceOSPlatform in~ ("Linux", "macOS")
| extend ImmediateShutdown = ProcessCommandLine has_any ("-t 0", "now", "+0")
| extend ForcedShutdown = ProcessCommandLine has_any ("-f", "--force")
| extend RemoteShutdown = false
| extend SuspiciousParent = InitiatingProcessFileName in~ (SuspiciousParents)
| extend RiskScore = toint(ImmediateShutdown) + toint(ForcedShutdown) + toint(SuspiciousParent) * 2
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
ImmediateShutdown, ForcedShutdown, RemoteShutdown, SuspiciousParent, RiskScore,
DetectionBranch="LinuxMacShutdown";
WindowsShutdown
| union PowerShellAPIAbuse
| union LinuxMacShutdown
| where RiskScore >= 1
| sort by RiskScore desc, Timestamp desc Detects system shutdown and reboot commands across Windows, Linux, and macOS using Microsoft Defender for Endpoint DeviceProcessEvents. Three detection branches cover: (1) Windows shutdown.exe with /s or /r flags, scored higher for /t 0 (immediate), /f (forced), or suspicious initiating process; (2) PowerShell invoking shutdown-related Windows API functions — ExitWindowsEx, NtRaiseHardError, ZwRaiseHardError, InitiateSystemShutdown — a near-zero false-positive indicator used by WhisperGate and BFG Agonizer; (3) Linux/macOS shutdown, reboot, halt, poweroff, and systemctl poweroff/reboot. Risk scoring allows threshold tuning: RiskScore 1 for routine shutdown commands, 3+ for forced/immediate, 4 for API abuse. Filter to RiskScore >= 3 in high-volume environments.
Data Sources
Required Tables
False Positives
- System administrators performing scheduled maintenance reboots via RMM agents (ConnectWise Control, Kaseya VSA, TeamViewer) — these typically spawn from the RMM agent process, not scripting hosts
- Windows Update process initiating reboots after patch installation — typically initiated by TrustedInstaller or svchost.exe with wuauserv service tag, with long /t timeout values
- Configuration management and patch automation platforms (Ansible WinRM, SCCM, Intune) executing shutdown commands as part of deployment or patch cycles — usually from known service accounts at scheduled times
- Hypervisor guest agents (VMware Tools vmtoolsd.exe, VirtualBox additions) performing coordinated shutdown during snapshot or migration operations
- Legitimate helpdesk personnel remotely rebooting endpoints via shutdown /m after troubleshooting sessions — identifiable by the /r flag (reboot, not shutdown) and corresponding helpdesk ticket
Sigma rule & cross-platform mapping
The detection logic for System Shutdown/Reboot (T1529) 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 T1529
References (12)
- https://attack.mitre.org/techniques/T1529/
- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown
- https://unit42.paloaltonetworks.com/agonizing-serpens-targets-israeli-tech-higher-ed-sectors/
- https://www.crowdstrike.com/en-us/blog/how-crowdstrike-falcon-protects-against-wiper-malware-used-in-ukraine-attacks/
- https://blog.talosintelligence.com/2018/02/olympic-destroyer.html
- https://blog.talosintelligence.com/2017/06/worldwide-ransomware-variant.html
- https://www.sentinelone.com/labs/acidpour-new-embedded-wiper-variant-of-acidrain-appears-in-ukraine/
- https://research.checkpoint.com/2021/mosesstaff-targeting-israeli-companies/
- https://www.sonicwall.com/blog/disarming-darkgate-a-deep-dive-into-thwarting-the-latest-darkgate-variant
- https://ntdoc.m417z.com/ntraiseharderror
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1529/T1529.md
- https://www.cisa.gov/uscert/ncas/alerts/TA18-106A
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 1Windows Shutdown Scheduled and Aborted (Safe Telemetry Test)
Expected signal: Sysmon Event ID 1: Process Create for shutdown.exe with CommandLine containing '/s /t 300 /c df00tech-detection-test'. System Event Log Event ID 1074 recording the initiated shutdown with process name and user SID. Second Sysmon Event ID 1 for shutdown.exe /a (abort, generates its own process creation event). Security Event ID 4688 for both executions if process auditing is enabled.
- Test 2Forced Immediate Reboot — Wiper Simulation (Lab VM Only)
Expected signal: Sysmon Event ID 1 (captured before reboot): Image=C:\Windows\System32\shutdown.exe, CommandLine='shutdown.exe /r /f /t 0'. System Event Log Event ID 1074 recorded immediately. Security Event ID 4688 if auditing enabled. After reboot: System Event Log Event ID 6006 (clean shutdown). Prefetch file SHUTDOWN.EXE-*.pf updated.
- Test 3PowerShell ExitWindowsEx API Reference (Safe — No Actual Shutdown)
Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'ExitWindowsEx'. PowerShell ScriptBlock Log Event ID 4104 in Microsoft-Windows-PowerShell/Operational showing the DllImport declaration. No actual shutdown occurs — P/Invoke signature is defined but the method is never invoked.
- Test 4Linux Shutdown Scheduled and Cancelled (Safe Telemetry Test)
Expected signal: Auditd EXECVE syscall record or Sysmon for Linux Event ID 1: execution of shutdown with arguments '-h +15 df00tech-detection-test'. Broadcast message to all logged-in users via wall. Second execution record for shutdown -c with cancellation message. /var/log/syslog or journald entries for both the scheduled shutdown and cancellation. sudo pam_unix authentication log entries.
Response Playbook
Triage
- Identify the initiating process: check ParentImage/InitiatingProcessFileName — was shutdown spawned by a scripting host (wscript.exe, cscript.exe, mshta.exe), a LOLBin (rundll32.exe, regsvr32.exe), or PowerShell? These are not legitimate parents for shutdown commands and require immediate escalation
- Examine the command line for urgency indicators: /t 0 combined with /f (force close all applications, immediate, no abort window) is never used by legitimate RMM tools or Windows Update — treat this combination as confirmed malicious until proven otherwise
- Check the user account context: was this executed by a service account outside a change window, by a domain admin with no corresponding ticket, or by SYSTEM without a Windows Update event (Event ID 19/20 in Microsoft-Windows-WindowsUpdateClient) preceding it?
- Review the 60-minute window BEFORE the shutdown for correlated destructive activity: shadow copy deletion (vssadmin delete shadows, wmic shadowcopy delete), BCDEdit recovery disablement (bcdedit /set recoveryenabled no), disk write activity to \\.\PhysicalDrive paths, or mass file encryption — any of these combined with a shutdown is a confirmed wiper/ransomware scenario
- For PowerShell API abuse (ExitWindowsEx, NtRaiseHardError, ZwRaiseHardError): check PowerShell ScriptBlock Log Event ID 4104 for the full deobfuscated script; note that NtRaiseHardError with OptionShutdownSystem typically requires SeShutdownPrivilege — check for preceding Access Token Manipulation (T1134) events
- For remote shutdown (/m flag): extract target hostnames from the command line argument and immediately check whether those hosts are also showing destructive activity — multi-host remote shutdown indicates automated propagation
Containment
- If system has not yet shut down and destructive activity is confirmed: initiate immediate memory acquisition via EDR live response (capture volatile process list, open network connections, loaded modules) before isolation — memory forensics is irretrievably lost at shutdown
- Network-isolate the endpoint using EDR group isolation policy or an emergency VLAN ACL — do NOT rely on the shutdown command itself being aborted via shutdown /a unless confirmed the timer is still running
- If remote shutdown (/m flag) was used against multiple targets: immediately identify all target hosts from the command line arguments, cross-reference with Active Directory, and initiate parallel isolation — this is an automated wiper propagation scenario requiring coordinated response
- Disable the initiating user account in Active Directory (Disable-ADAccount) and revoke all active Kerberos tickets (klist purge on affected hosts or domain-wide if account is privileged) — do not merely reset the password as the attacker likely has credential material for re-authentication
- Verify backup integrity before attempting recovery: wiper campaigns specifically target backup infrastructure (Qilin targets backup servers) — confirm backups are online, untampered, and recoverable before proceeding with restoration planning
- If system has already rebooted and fails to boot (indicating MBR/VBR wipe): treat the disk as forensic evidence, do NOT attempt in-place repair — image the disk before any recovery attempts preserve chain of custody
Evidence Collection
- Windows System Event Log Event ID 1074 (User-Initiated Restart/Shutdown): records the initiating process name, user SID, shutdown type code, and comment string — primary evidence of who and what triggered the shutdown
- Windows System Event Log Event ID 6006 (clean shutdown completed) and Event ID 6008 (unexpected/dirty shutdown): 6008 after wiper activity indicates the system was forced off without proper shutdown sequence
- Windows Security Event ID 4688 (Process Creation with Command Line): captures shutdown.exe invocation in environments with process auditing enabled — confirm 'Include command line in process creation events' GPO is active
- Sysmon Event ID 1 (Process Create): full command line, parent process, user SID, and hash of shutdown.exe — verify the hash matches the legitimate Windows binary to rule out masqueraded malware
- PowerShell ScriptBlock Log Event ID 4104 (Microsoft-Windows-PowerShell/Operational): full deobfuscated script content when PowerShell API abuse is detected — captures ExitWindowsEx or NtRaiseHardError call with parameters
- Prefetch files: C:\Windows\Prefetch\SHUTDOWN.EXE-*.pf — confirms execution timestamp and loaded DLLs, survives a clean reboot (destroyed by wiper if MFT is wiped)
- Windows System Event Log Service Control Manager Event ID 7036 (service state change): review the sequence of services stopped before shutdown — abnormal stop order (e.g., security services stopping before shutdown command) indicates pre-shutdown tampering
- Linux: journald persistent log at /var/log/journal/ — contains systemctl poweroff/reboot entries with initiating user UID and timestamp; also check /var/log/auth.log for sudo shutdown invocations
- Linux: /var/log/wtmp read via `last -x | grep -E 'shutdown|reboot'` — provides historical shutdown audit trail with timestamps and terminal
- ESXi: /var/log/hostd.log and /var/log/shell.log — record vim-cmd vmsvc/power.shutdown and esxcli system shutdown commands with source IP and credentials used
Escalation Criteria
- ! Shutdown immediately follows confirmed destructive activity in the preceding 30-60 minutes: shadow copy deletion, BCDEdit recovery disablement, disk wipe targeting PhysicalDrive, or mass file modification consistent with encryption — this combination is definitive ransomware/wiper execution
- ! PowerShell command line contains ExitWindowsEx, NtRaiseHardError, ZwRaiseHardError, or OptionShutdownSystem — these programmatic Windows API shutdown methods are not used by any legitimate administrative tooling and constitute a near-zero false-positive indicator of malware
- ! Shutdown initiated by a non-privileged user account, a service account without a corresponding change ticket, or SYSTEM with no preceding Windows Update events — any of these indicate unauthorized shutdown
- ! Remote shutdown (/m flag) targeting 3 or more hosts within a 30-minute window — indicates automated wiper/ransomware propagation pattern consistent with Olympic Destroyer and similar campaigns
- ! System fails to boot after the shutdown event — strong indicator of MBR/VBR wipe (T1561.002) or boot configuration destruction (T1490); escalate to incident commander and initiate IR retainer engagement
- ! Shutdown preceded by SeShutdownPrivilege acquisition via token impersonation or privilege escalation — indicates deliberate staging for programmatic shutdown API calls consistent with Agrius group's BFG Agonizer and MultiLayer Wiper
Investigation Guide
Forensic Artifacts
- >
Windows System Event Log Event ID 1074: records process name, user SID, shutdown type (0=shutdown, 2=reboot, 5=legacy), reason code, and optional comment — most complete single artifact for shutdown attribution - >
Windows System Event Log Event ID 6006 (clean shutdown) and 6008 (unexpected/dirty shutdown): 6008 with preceding destructive activity is a high-fidelity wiper indicator - >
Windows Security Event ID 4688 with New Process Name = shutdown.exe and Subject fields showing initiating user — requires 'Audit Process Creation' and 'Include command line in process creation events' GPO enabled - >
Prefetch: C:\Windows\Prefetch\SHUTDOWN.EXE-*.pf — execution timestamps and referenced DLLs; absence of this file when shutdown.exe was executed may indicate prefetch disabling (T1070) by the attacker - >
Registry: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\CrashDumpEnabled — if set to 0 before BSOD-inducing shutdown (NtRaiseHardError), attacker disabled crash dump to prevent memory forensics - >
Sysmon Event ID 1 (Process Create): parent-child chain for shutdown.exe invocation with MD5/SHA256 hash to verify binary authenticity — masqueraded malware may use shutdown.exe filename - >
PowerShell ScriptBlock Log (Event ID 4104 in Microsoft-Windows-PowerShell/Operational): full deobfuscated script content showing API function declarations and shutdown flag values - >
Linux journald persistent log at /var/log/journal/: survives clean reboots; contains systemctl/shutdown invocations with user UID, PID, and exact arguments - >
Linux /var/log/wtmp via `last -x | grep -E 'shutdown|reboot'`: historical shutdown audit trail with terminal context - >
ESXi /var/log/hostd.log: records vim-cmd vmsvc/power.shutdown and esxcli system shutdown poweroff commands with authenticated user and source IP for VM and host shutdown events
Tuning Guidance
Start by building an allowlist of legitimate shutdown actors in your environment: (1) RMM agents — identify the parent process names for ConnectWise Control (ScreenConnect.ClientService.exe), Kaseya VSA (AgentMon.exe), TeamViewer (TeamViewer_Service.exe), and suppress shutdown.exe events where InitiatingProcessFileName exactly matches these known-good agents; (2) Windows Update — suppress events where InitiatingProcessFileName is TrustedInstaller.exe or where the command line contains /r without /f and without /t 0; (3) SCCM/Intune — suppress events from the service accounts configured for software deployment during known maintenance windows. For the PowerShell API abuse branch (ExitWindowsEx, NtRaiseHardError), do NOT suppress — legitimate software virtually never invokes these shutdown APIs from PowerShell command lines; the false positive rate for this branch is near zero. Tune the RiskScore threshold rather than suppressing entire pattern classes: RiskScore >= 1 for alerting (broad), >= 3 for high-priority triage (immediate/forced + suspicious parent), >= 4 for PowerShell API abuse (automatic escalation). Enable Windows Security Event ID 1074 collection via your SIEM to provide attribution context for every alert. On Linux, suppress systemctl reboot events where the initiating process matches your known update manager (unattended-upgrades, yum-cron, dnf-automatic) using a service account allowlist.
Hunting Queries
Hunts for systems where a shutdown/reboot command occurs within 60 minutes of confirmed destructive precursor activity (shadow copy deletion, BCDEdit recovery disablement, diskpart operations). This temporal correlation is the strongest available indicator of wiper/ransomware completion — seen in Olympic Destroyer, WhisperGate, Apostle, AcidRain, and MultiLayer Wiper. Systems matching this query require immediate incident response regardless of the shutdown command's specifics.
// Hunt: shutdown correlated with destructive precursor activity within 60 minutes
let DestructiveActivity = DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("vssadmin.exe", "wbadmin.exe", "bcdedit.exe", "wmic.exe", "diskpart.exe", "cipher.exe")
| where ProcessCommandLine has_any (
"shadowcopy delete", "delete shadows", "delete catalog",
"recoveryenabled no", "bootstatuspolicy ignoreallfailures",
"delete systemstatebackup", "/w:"
)
| project DestructiveTime=Timestamp, DeviceName, DestructiveProcess=FileName, DestructiveCmdLine=ProcessCommandLine;
let ShutdownEvents = DeviceProcessEvents
| where Timestamp > ago(7d)
| where (FileName =~ "shutdown.exe" and ProcessCommandLine has_any ("/s", "/r"))
or (FileName in~ ("powershell.exe", "pwsh.exe") and ProcessCommandLine has_any ("ExitWindowsEx", "NtRaiseHardError", "ZwRaiseHardError"))
| project ShutdownTime=Timestamp, DeviceName, ShutdownProcess=FileName, ShutdownCmdLine=ProcessCommandLine;
ShutdownEvents
| join kind=inner DestructiveActivity on DeviceName
| where ShutdownTime > DestructiveTime
| where datetime_diff('minute', ShutdownTime, DestructiveTime) <= 60
| extend MinutesBetween = datetime_diff('minute', ShutdownTime, DestructiveTime)
| project ShutdownTime, DestructiveTime, MinutesBetween, DeviceName, ShutdownCmdLine, DestructiveProcess, DestructiveCmdLine
| sort by MinutesBetween asc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*\\shutdown.exe" OR Image="*\\powershell.exe" OR Image="*\\pwsh.exe")
(CommandLine="*/s*" OR CommandLine="*/r*" OR CommandLine="*ExitWindowsEx*" OR CommandLine="*NtRaiseHardError*")
| eval shutdown_time=_time
| eval is_shutdown=1
| append [
search index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*\\vssadmin.exe" OR Image="*\\wbadmin.exe" OR Image="*\\bcdedit.exe" OR Image="*\\diskpart.exe")
(CommandLine="*shadowcopy*delete*" OR CommandLine="*recoveryenabled*no*" OR CommandLine="*delete shadows*" OR CommandLine="*delete catalog*")
| eval is_destructive=1
]
| stats values(CommandLine) as Commands, values(is_shutdown) as HasShutdown, values(is_destructive) as HasDestructive, min(_time) as earliest, max(_time) as latest by host
| where HasShutdown=1 AND HasDestructive=1
| eval TimeSpanMinutes=round((latest-earliest)/60,1)
| where TimeSpanMinutes <= 60
| table host, TimeSpanMinutes, Commands, earliest, latest
| sort TimeSpanMinutes Hunts for a single source host issuing remote shutdown commands (shutdown /m) against 3 or more unique targets within a 30-minute window. This worm-like propagation pattern — one infected host forcing reboots across the environment — was observed in Olympic Destroyer and is consistent with automated wiper deployment. Single source with high UniqueTargets count is a critical escalation indicator regardless of other signals.
// Hunt: multi-host remote shutdown propagation (automated wiper spread pattern)
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "shutdown.exe"
| where ProcessCommandLine has "/m"
| extend TargetHost = extract(@"/m\s+([\\\\]+[^\s]+|\S+)", 1, ProcessCommandLine)
| where isnotempty(TargetHost)
| summarize
RemoteShutdownCount = count(),
UniqueTargets = dcount(TargetHost),
TargetList = make_set(TargetHost, 20),
Accounts = make_set(AccountName),
CommandLines = make_set(ProcessCommandLine)
by SourceDevice=DeviceName, bin(Timestamp, 30m)
| where UniqueTargets >= 3
| sort by UniqueTargets desc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
Image="*\\shutdown.exe" CommandLine="*/m*"
| rex field=CommandLine "/m\s+(?<TargetHost>[^\s]+)"
| where isnotnull(TargetHost) AND len(TargetHost) > 2
| bin _time span=30m
| stats count as RemoteShutdownCount, dc(TargetHost) as UniqueTargets, values(TargetHost) as TargetList, values(User) as Accounts by host, _time
| where UniqueTargets >= 3
| sort - UniqueTargets Hunts for user-account-initiated shutdown commands outside business hours (before 06:00 or after 22:00 UTC) or on weekends. Ransomware and wiper campaigns deliberately execute during off-hours to maximize dwell time and minimize rapid response. This pattern excludes SYSTEM, LOCAL SERVICE, and NETWORK SERVICE accounts (legitimate scheduled reboots) while surfacing human-account shutdowns at unusual times — a consistent behavioral indicator across ransomware groups including Qilin and LockerGoga.
// Hunt: off-hours shutdown by non-system accounts (attacker timing to evade detection)
DeviceProcessEvents
| where Timestamp > ago(14d)
| where FileName =~ "shutdown.exe"
| where ProcessCommandLine has_any ("/s", "/r")
| where AccountName !in~ ("SYSTEM", "LOCAL SERVICE", "NETWORK SERVICE")
| extend HourUTC = datetime_part("Hour", Timestamp)
| extend DayOfWeek = dayofweek(Timestamp)
| extend IsOffHours = HourUTC < 6 or HourUTC >= 22
| extend IsWeekend = DayOfWeek in (0d, 6d)
| where IsOffHours or IsWeekend
| summarize
Count = count(),
Devices = dcount(DeviceName),
DeviceList = make_set(DeviceName),
CommandLines = make_set(ProcessCommandLine)
by AccountName, IsOffHours, IsWeekend, bin(Timestamp, 1h)
| sort by Count desc index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
Image="*\\shutdown.exe" (CommandLine="*/s*" OR CommandLine="*/r*")
NOT (User="SYSTEM" OR User="LOCAL SERVICE" OR User="NETWORK SERVICE" OR User="NT AUTHORITY\\SYSTEM")
| eval hour=tonumber(strftime(_time, "%H"))
| eval dow=tonumber(strftime(_time, "%w"))
| eval IsOffHours=if(hour < 6 OR hour >= 22, 1, 0)
| eval IsWeekend=if(dow = 0 OR dow = 6, 1, 0)
| where IsOffHours=1 OR IsWeekend=1
| bin _time span=1h
| stats count as ShutdownCount, dc(host) as UniqueHosts, values(host) as HostList, values(CommandLine) as Commands by User, IsOffHours, IsWeekend, _time
| sort - ShutdownCount Atomic Red Team Tests
Schedules a system shutdown 5 minutes in the future then immediately aborts it using shutdown /a. This generates the Sysmon Event ID 1 process creation event for shutdown.exe with /s flag, populates System Event Log Event ID 1074, and then creates a second process creation event for the abort — all without actually shutting down the system. Simulates the telemetry that would be generated by malware scheduling an immediate post-wipe shutdown.
Command
cmd.exe /c "shutdown.exe /s /t 300 /c "df00tech-detection-test" && timeout /t 3 /nobreak && shutdown.exe /a" Cleanup
shutdown.exe /a 2>nul Expected Telemetry
Sysmon Event ID 1: Process Create for shutdown.exe with CommandLine containing '/s /t 300 /c df00tech-detection-test'. System Event Log Event ID 1074 recording the initiated shutdown with process name and user SID. Second Sysmon Event ID 1 for shutdown.exe /a (abort, generates its own process creation event). Security Event ID 4688 for both executions if process auditing is enabled.
Expected Detection
KQL WindowsShutdown branch fires: FileName=shutdown.exe, ProcessCommandLine has '/s', ImmediateShutdown=false (300s delay), ForcedShutdown=false, RiskScore=1. SPL fires: IsWindowsShutdownExe=1, RiskScore=1. Parent process is cmd.exe which scores SuspiciousParent=1 in some configurations, raising RiskScore to 3.
Executes an immediate forced system reboot mirroring the exact command line used by APT37 malware (shutdown /r /t 1 after MBR wipe), LockerGoga, and similar destructive malware. WARNING: This WILL immediately reboot the system. Only execute in a dedicated disposable lab VM with no production workloads. The /f flag forces all applications to close without saving data, and /t 0 eliminates the abort window — the highest-risk combination in this technique.
Command
shutdown.exe /r /f /t 0 Expected Telemetry
Sysmon Event ID 1 (captured before reboot): Image=C:\Windows\System32\shutdown.exe, CommandLine='shutdown.exe /r /f /t 0'. System Event Log Event ID 1074 recorded immediately. Security Event ID 4688 if auditing enabled. After reboot: System Event Log Event ID 6006 (clean shutdown). Prefetch file SHUTDOWN.EXE-*.pf updated.
Expected Detection
KQL: ImmediateShutdown=true, ForcedShutdown=true, RiskScore=2 minimum (higher if parent is suspicious). SPL: ImmediateShutdown=1, ForcedShutdown=1, RiskScore >= 2. This combination warrants immediate escalation per playbook criteria.
Uses PowerShell to define the ExitWindowsEx P/Invoke signature without calling it — the command line still contains 'ExitWindowsEx' which is the string the detection queries match on. This safely generates the process creation telemetry that wiper malware like WhisperGate (which calls ExitWindowsEx with EWX_SHUTDOWN flag 0x00000001) produces during execution. In a real attack, the adversary would require SeShutdownPrivilege for the call to succeed.
Command
powershell.exe -NoProfile -Command "$sig = '[DllImport(\"user32.dll\")] public static extern bool ExitWindowsEx(uint uFlags, uint dwReason);'; Write-Host 'ExitWindowsEx P/Invoke signature loaded - detection test only, no shutdown called'" Expected Telemetry
Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'ExitWindowsEx'. PowerShell ScriptBlock Log Event ID 4104 in Microsoft-Windows-PowerShell/Operational showing the DllImport declaration. No actual shutdown occurs — P/Invoke signature is defined but the method is never invoked.
Expected Detection
KQL PowerShellAPIAbuse branch fires: FileName in (powershell.exe), ProcessCommandLine has 'ExitWindowsEx', RiskScore=4 (maximum baseline). SPL: IsPowerShellAPI=1, RiskScore=4. This branch should auto-escalate per playbook criteria regardless of other context.
On Linux systems, schedules a shutdown 15 minutes in the future and then immediately cancels it. Generates process creation telemetry for the shutdown command with time argument — the pattern used by AcidRain and AcidPour wiper malware after completing disk wiping operations on embedded Linux devices. Safe to execute on any Linux system; the cancellation immediately follows the schedule command.
Command
sudo shutdown -h +15 'df00tech-detection-test' ; sleep 2 ; sudo shutdown -c 'df00tech-detection-test cancelled' Cleanup
sudo shutdown -c 2>/dev/null || true Expected Telemetry
Auditd EXECVE syscall record or Sysmon for Linux Event ID 1: execution of shutdown with arguments '-h +15 df00tech-detection-test'. Broadcast message to all logged-in users via wall. Second execution record for shutdown -c with cancellation message. /var/log/syslog or journald entries for both the scheduled shutdown and cancellation. sudo pam_unix authentication log entries.
Expected Detection
KQL LinuxMacShutdown branch fires: FileName='shutdown', DeviceOSPlatform='Linux', ImmediateShutdown=false (not 'now'), RiskScore=1 (or higher if SuspiciousParent). SPL: IsLinuxMacShutdown=1, RiskScore=1. The cancellation does not generate a detection — only the schedule command fires the alert.