T1059.003

Windows Command Shell

Adversaries may abuse the Windows command shell for execution. The Windows command shell (cmd.exe) is the primary command prompt on Windows systems. The Windows command prompt can be used to control almost any aspect of a system, with various permission levels required for different subsets of commands. The command prompt can be invoked remotely via Remote Services such as SSH. Batch files (.bat or .cmd) also provide the shell with a list of sequential commands to run. Adversaries may leverage cmd.exe to execute various commands and payloads, including single commands, interactive shells with C2 forwarding, and batch file execution.

Microsoft Sentinel / Defender
kusto
let SuspiciousPatterns = dynamic([
  "certutil -urlcache", "certutil -decode", "certutil -encode",
  "bitsadmin /transfer", "bitsadmin /create",
  "reg add", "reg delete", "reg save",
  "schtasks /create", "schtasks /change",
  "net user /add", "net localgroup administrators",
  "wmic process call create", "wmic shadowcopy delete",
  "vssadmin delete shadows", "bcdedit /set",
  "icacls /grant", "takeown /f",
  "echo | set /p=", "for /f",
  "ping -n 1 -w", "> \\\\pipe\\"
]);
let SuspiciousParents = dynamic(["winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe", "mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "regsvr32.exe"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "cmd.exe"
| where ProcessCommandLine has_any (SuspiciousPatterns) or InitiatingProcessFileName has_any (SuspiciousParents)
| extend CertutilAbuse = ProcessCommandLine has_any ("certutil -urlcache", "certutil -decode")
| extend ScheduledTask = ProcessCommandLine has "schtasks /create"
| extend UserCreation = ProcessCommandLine has "net user /add"
| extend ShadowDelete = ProcessCommandLine has_any ("vssadmin delete shadows", "wmic shadowcopy delete")
| extend SuspiciousParent = InitiatingProcessFileName has_any (SuspiciousParents)
| project Timestamp, DeviceName, AccountName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         CertutilAbuse, ScheduledTask, UserCreation, ShadowDelete, SuspiciousParent
| sort by Timestamp desc
high severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • System administrators using cmd.exe with certutil for legitimate certificate operations
  • Deployment scripts that create scheduled tasks for software installation or patching
  • Backup solutions that interact with VSS shadow copies during backup operations
  • IT automation tools using batch files for endpoint configuration

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections