Detect Hypervisor CLI in Elastic Security
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.
MITRE ATT&CK
- Tactic
- Execution
- Technique
- T1059 Command and Scripting Interpreter
- Sub-technique
- T1059.012 Hypervisor CLI
- Canonical reference
- https://attack.mitre.org/techniques/T1059/012/
Elastic Detection Query
sequence by host.name with maxspan=5m
[process where event.type == "start" and
host.os.type == "linux" and
(
process.name in ("esxcli", "vim-cmd", "esxcfg-firewall", "esxcfg-vswitch") or
process.executable in ("/sbin/esxcli", "/bin/vim-cmd", "/sbin/esxcfg-firewall")
) and
(
process.args : ("vm process kill", "vm process list", "vmsvc/power.off", "vmsvc/getallvms",
"system maintenanceMode", "network firewall*", "network ip*",
"software vib install", "software vib remove", "software acceptance set",
"system syslog", "system settings advanced",
"hostsvc/enable_ssh", "hostsvc/start_ssh", "solo/registervm") or
process.command_line : ("*chmod +x*", "*nohup *", "*.vmdk*", "*.vmx*", "*.vmsd*", "*.vmsn*")
)
] by process.pid
| where
(process.args : ("vm process kill", "vmsvc/power.off")) or
(process.args : ("software vib install", "software vib remove", "software acceptance set")) or
(process.args : ("network firewall*")) or
(process.args : ("hostsvc/enable_ssh", "hostsvc/start_ssh")) or
(process.args : ("system syslog")) Detects abuse of ESXi hypervisor CLIs (esxcli, vim-cmd) for VM termination, VIB installation, firewall manipulation, SSH enablement, and syslog tampering. Covers ransomware pre-encryption enumeration and UNC3886-style malware installation patterns.
Data Sources
Required Tables
False Positives & Tuning
- Authorized VMware administrators running routine maintenance tasks such as VIB updates, VM power management, or firewall reconfiguration via scheduled jobs or change windows
- Monitoring and orchestration tools (vCenter, Ansible, Puppet) that invoke esxcli or vim-cmd programmatically as part of automated VM lifecycle management
- Legitimate backup and DR software (Veeam, Zerto) that uses esxcli to enumerate VMs and snapshot states during scheduled backup windows
Other platforms for T1059.012
Testing Methodology
Validate this detection against 3 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 1ESXi VM Enumeration Simulation
Expected signal: Syslog message with facility local7 containing 'esxcli vm process list'. This validates that ESXi-format syslog messages are being ingested by the SIEM.
- Test 2ESXi VIB Installation Simulation
Expected signal: Syslog message with facility local7 containing 'vib install' and '--no-sig-check'. The --no-sig-check flag bypasses signature verification.
- Test 3ESXi VM Kill Simulation
Expected signal: Syslog message with facility local7 containing 'vm process kill --type=force'. The force kill type is used by ransomware to immediately terminate VMs.
References (6)
- https://attack.mitre.org/techniques/T1059/012/
- https://developer.broadcom.com/xapis/esxcli-command-reference/latest/
- https://lolesxi-project.github.io/LOLESXi/
- https://www.crowdstrike.com/en-us/blog/hypervisor-jackpotting-ecrime-actors-increase-targeting-of-esxi-servers/
- https://www.mandiant.com/resources/blog/esxi-hypervisors-malware-persistence
- https://www.trendmicro.com/en_us/research/22/e/new-linux-based-ransomware-cheerscrypt-targets-exsi-devices.html
Unlock Pro Content
Get the full detection package for T1059.012 including response playbook, investigation guide, and atomic red team tests.