T1561.002 Microsoft Sentinel · KQL

Detect Disk Structure Wipe in Microsoft Sentinel

Adversaries may corrupt or wipe disk data structures such as the Master Boot Record (MBR), GUID Partition Table (GPT), or partition entries to render systems permanently unbootable. Wiper malware (Shamoon, HermeticWiper, WhisperGate, CaddyWiper, KillDisk) achieves this by opening a handle to raw physical disk devices (e.g., \\.\PhysicalDrive0) and overwriting the first 512 bytes (MBR boot sector) or subsequent partition structures. Some malware uses kernel-mode drivers such as ElRawDisk.sys (Shamoon) or the HermeticWiper EaseUS driver to bypass user-mode restrictions and gain direct disk sector access. On Linux systems, adversaries use utilities like dd with /dev/zero or /dev/urandom targeting /dev/sda or /dev/nvme0n1. This technique is frequently combined with worm-like propagation via SMB/Windows Admin Shares, Valid Accounts, and OS Credential Dumping to maximize organizational impact.

MITRE ATT&CK

Tactic
Impact
Technique
T1561 Disk Wipe
Sub-technique
T1561.002 Disk Structure Wipe
Canonical reference
https://attack.mitre.org/techniques/T1561/002/

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// Detection 1: Processes with raw physical disk handle access patterns
let PhysicalDriveAccess = DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has "PhysicalDrive"
   or ProcessCommandLine has "\\\\.\\PHYSICALDRIVE"
   or ProcessCommandLine has "physicaldrive"
| extend AccessType = "RawDiskHandle"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          ProcessId, InitiatingProcessId, AccessType;
// Detection 2: dd.exe or disk utility wipe commands
let WiperToolCommands = DeviceProcessEvents
| where Timestamp > ago(24h)
| where (
    (FileName =~ "dd.exe" and (ProcessCommandLine has "PhysicalDrive" or ProcessCommandLine has "if=/dev/zero" or ProcessCommandLine has "if=/dev/urandom"))
    or (FileName =~ "diskpart.exe" and InitiatingProcessFileName !in~ ("mmc.exe", "diskmgmt.msc"))
    or (FileName in~ ("shred", "wipe") and ProcessCommandLine has_any ("/dev/sd", "/dev/hd", "/dev/nvme", "/dev/vd"))
  )
| extend AccessType = "WiperTool"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
          InitiatingProcessFileName, InitiatingProcessCommandLine,
          ProcessId, InitiatingProcessId, AccessType;
// Detection 3: Known wiper driver files dropped to non-standard paths
let WiperDriverDrop = DeviceFileEvents
| where Timestamp > ago(24h)
| where FileName endswith ".sys"
| where (
    FileName has_any ("elrawdsk", "ElRawDisk", "epmntdrv", "EPMNTDRV", "HermeticWiper")
    or (FolderPath has_any ("Temp", "AppData", "ProgramData", "Downloads") and FileName endswith ".sys")
  )
| extend AccessType = "WiperDriverDrop"
| project Timestamp, DeviceName, FileName, FolderPath,
          InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName,
          AccessType;
// Detection 4: Suspicious service installation for raw disk drivers (Event ID 7045)
let ServiceInstall = SecurityEvent
| where TimeGenerated > ago(24h)
| where EventID == 7045
| where ServiceType =~ "kernel mode driver"
| where ServiceFileName has_any ("Temp", "AppData", "ProgramData", "Users", "Downloads")
| extend AccessType = "SuspiciousDriverService"
| project TimeGenerated as Timestamp, Computer as DeviceName, ServiceName, ServiceFileName, AccessType;
union isfuzzy=true PhysicalDriveAccess, WiperToolCommands
| extend IsKnownWiper = FileName has_any ("Shamoon", "wiper", "HermeticWiper", "KillDisk", "CaddyWiper")
| extend IsDDTool = FileName =~ "dd.exe"
| extend IsDiskpart = FileName =~ "diskpart.exe"
| extend HasPhysicalDriveRef = ProcessCommandLine has "PhysicalDrive"
| sort by Timestamp desc
critical severity high confidence

Detects disk structure wiping activity targeting MBR, GPT, and physical disk sectors using four complementary detection vectors: (1) processes with raw physical disk handle references in command lines, (2) disk utility commands (dd.exe, diskpart.exe) invoked with destructive arguments, (3) wiper-associated kernel driver files (ElRawDisk.sys, epmntdrv.sys) dropped to user-writable paths, and (4) kernel driver service installations from non-standard locations via Security Event 7045. This multi-vector approach catches both commodity wiper tooling and custom malware families.

Data Sources

Process: Process CreationFile: File CreationDriver: Driver LoadWindows: Security Event LogMicrosoft Defender for Endpoint

Required Tables

DeviceProcessEventsDeviceFileEventsSecurityEvent

False Positives & Tuning

  • Legitimate disk imaging and backup software (Acronis True Image, Macrium Reflect, Clonezilla agent) that opens PhysicalDrive handles for sector-level backup and restore operations
  • Hardware diagnostic and benchmarking utilities (CrystalDiskInfo, HD Tune, manufacturer tools like Seagate SeaTools) that read raw disk sectors to retrieve SMART data or perform surface scans
  • Forensic acquisition tools (FTK Imager, dc3dd, Paladin) used by security teams that write forensic images by accessing physical disk handles directly
  • System administrators using dd.exe (GnuWin32/UnxUtils port) for disk cloning or image creation in lab and deployment environments
  • Virtualization platforms (VMware vSphere, VirtualBox, Hyper-V) that create and manage virtual disk files using driver-level disk access
Download portable Sigma rule (.yml)

Other platforms for T1561.002


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.

  1. Test 1MBR Overwrite Simulation on VHD (Windows, Safe)

    Expected signal: Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing 'PhysicalDrive'. Sysmon Event ID 11: File Creation for mbr-test.vhd in %TEMP%. DeviceProcessEvents will show the PowerShell process with the raw disk handle pattern. Windows Event ID 4688 (if command-line auditing enabled) captures the full PowerShell command. DeviceFileEvents captures the VHD file creation.

  2. Test 2Kernel Driver Drop to Temp Directory (Windows)

    Expected signal: Sysmon Event ID 11: File Created — TargetFilename matches '*\Temp\elrawdsk.sys'. Sysmon Event ID 1: Process Create for powershell.exe invoking New-Service. Windows System Event ID 7045: New Service Installed with ServiceName=RawDiskDrv, ServiceFileName pointing to %TEMP%\elrawdsk.sys, ServiceType=kernel mode driver. Security Event ID 4697: A service was installed in the system.

  3. Test 3Linux MBR Overwrite on Loop Device (Linux, Safe)

    Expected signal: Sysmon for Linux (if deployed): ProcessCreate event showing dd with arguments 'if=/dev/zero of=/dev/loop* bs=512 count=1'. auditd (if configured with execve rules): EXECVE record capturing the full dd command with the loop device path. /var/log/auth.log or journald: sudo/su records if the test required privilege elevation. bash_history: dd command with /dev/zero source.

  4. Test 4WhisperGate-Style Malicious Bootloader Drop Pattern (Windows)

    Expected signal: Sysmon Event ID 11: File Created — TargetFilename '$env:TEMP\stage1.bin'. Sysmon Event ID 1: Process Create for powershell.exe with CommandLine containing '[Convert]::FromBase64String' and 'WriteAllBytes'. PowerShell ScriptBlock Log Event ID 4104: full script with staging path and base64 operations. DeviceFileEvents: file creation event for stage1.bin in TEMP.

Unlock Pro Content

Get the full detection package for T1561.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections