T1059.012

Hypervisor CLI

Adversaries may abuse hypervisor command line interpreters (CLIs) to execute malicious commands. Hypervisor CLIs enable functionality for managing both the hypervisor and guest virtual machines. On ESXi systems, tools such as esxcli and vim-cmd allow administrators to configure firewall rules, manage log forwarding, list/start/stop virtual machines, and more. Adversaries leverage these tools for discovery, VM termination (ransomware), firewall manipulation, and persistence. UNC3886 used esxcli extensively for malware installation and artifact removal. Ransomware families including Cheerscrypt, Royal, and BlackBasta use esxcli to enumerate and terminate VMs before encryption.

Microsoft Sentinel / Defender
kusto
let SuspiciousCommands = dynamic([
  "esxcli vm process kill", "esxcli vm process list",
  "vim-cmd vmsvc/power.off", "vim-cmd vmsvc/getallvms",
  "esxcli system maintenanceMode",
  "esxcli network firewall", "esxcli network ip",
  "esxcli software vib install", "esxcli software vib remove",
  "esxcli software acceptance set",
  "esxcli system syslog", "esxcli system settings advanced",
  "vim-cmd hostsvc/enable_ssh", "vim-cmd hostsvc/start_ssh",
  "vim-cmd solo/registervm",
  "/sbin/esxcli", "/bin/vim-cmd",
  "chmod +x", "nohup",
  ".vmdk", ".vmx", ".vmsd", ".vmsn"
]);
Syslog
| where TimeGenerated > ago(24h)
| where Computer has_any ("esx", "vmware") or ProcessName has_any ("esxcli", "vim-cmd", "hostd", "vpxa")
| where SyslogMessage has_any (SuspiciousCommands)
| extend VMKill = SyslogMessage has_any ("vm process kill", "power.off")
| extend VIBInstall = SyslogMessage has "vib install"
| extend FirewallChange = SyslogMessage has "network firewall"
| extend SSHEnable = SyslogMessage has_any ("enable_ssh", "start_ssh")
| extend SyslogModify = SyslogMessage has "system syslog"
| project TimeGenerated, Computer, ProcessName, SyslogMessage,
         VMKill, VIBInstall, FirewallChange, SSHEnable, SyslogModify
| sort by TimeGenerated desc
critical severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Application Log: Application Log Content

Required Tables

Syslog

False Positives

  • VMware administrators performing routine VM management (start/stop VMs during maintenance)
  • Patching operations installing legitimate VIBs during scheduled maintenance windows
  • Infrastructure automation tools (vRealize, Ansible) managing ESXi hosts

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections