T1673

Virtual Machine Discovery

Discovery Last updated:

This detection identifies adversaries attempting to enumerate virtual machines running on hypervisors or virtualization platforms. Attackers who gain access to a hypervisor host — such as VMware ESXi, Hyper-V, or KVM — commonly enumerate all running VMs as a precursor to destructive operations like ransomware deployment or service disruption. Key indicators include execution of hypervisor CLI tools (esxcli, vim-cmd, virsh, VBoxManage), PowerShell Hyper-V cmdlets (Get-VM, Get-VMHost), and unauthorized access to vSphere or vCenter management interfaces. This technique has been observed by ransomware groups including Cheerscrypt, Qilin, and Play, as well as nation-state actors like UNC3886 targeting ESXi infrastructure.

What is T1673 Virtual Machine Discovery?

Virtual Machine Discovery (T1673) maps to the Discovery tactic — the adversary is trying to figure out your environment in MITRE ATT&CK.

This page provides production-ready detection logic for Virtual Machine Discovery, covering the data sources and telemetry it touches: Microsoft Defender for Endpoint. The queries below are rated high severity at high confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Discovery
Technique
T1673 Virtual Machine Discovery
Canonical reference
https://attack.mitre.org/techniques/T1673/
Microsoft Sentinel / Defender
kusto
let VMDiscoveryPatterns = dynamic(["vm process list", "vmsvc/getallvms", "vmsvc/power.getstate", "vmsvc/getallvms", "esxcli vm", "esxcli storage", "esxcli network vm"]);
let HyperVCmdlets = dynamic(["Get-VM", "Get-VHD", "Get-VMHost", "Get-VMSwitch", "Get-VMNetworkAdapter", "Get-VMSnapshot", "Get-VMReplication"]);
let VBoxCommands = dynamic(["list vms", "list runningvms", "list hdds"]);
DeviceProcessEvents
| where Timestamp > ago(1d)
| where (
    // VMware ESXi enumeration via esxcli or vim-cmd
    (ProcessCommandLine has_any ("esxcli", "vim-cmd") and ProcessCommandLine has_any (VMDiscoveryPatterns))
    // Hyper-V enumeration via PowerShell
    or (FileName in~ ("powershell.exe", "pwsh.exe") and ProcessCommandLine has_any (HyperVCmdlets))
    // VirtualBox management enumeration
    or (FileName =~ "VBoxManage.exe" and ProcessCommandLine has_any (VBoxCommands))
    // VMware Workstation/Fusion vmrun list
    or (FileName =~ "vmrun.exe" and ProcessCommandLine has "list")
    // virsh enumeration on Windows Subsystem or cross-platform tools
    or (FileName =~ "virsh.exe" and ProcessCommandLine has_any ("list", "dominfo", "nodeinfo"))
    // prlctl (Parallels) enumeration
    or (FileName =~ "prlctl" and ProcessCommandLine has "list")
)
| extend CommandType = case(
    ProcessCommandLine has_any ("esxcli", "vim-cmd"), "ESXi-CLI",
    FileName in~ ("powershell.exe", "pwsh.exe") and ProcessCommandLine has_any (HyperVCmdlets), "HyperV-PowerShell",
    FileName =~ "VBoxManage.exe", "VirtualBox-CLI",
    FileName =~ "vmrun.exe", "VMware-Workstation",
    FileName =~ "virsh.exe", "KVM-virsh",
    "Other"
)
| project
    Timestamp,
    DeviceName,
    AccountName,
    AccountDomain,
    FileName,
    ProcessCommandLine,
    InitiatingProcessFileName,
    InitiatingProcessCommandLine,
    InitiatingProcessAccountName,
    CommandType,
    FolderPath,
    ProcessId
| order by Timestamp desc

Detects execution of hypervisor management CLI tools and PowerShell cmdlets used to enumerate virtual machines across VMware ESXi (esxcli, vim-cmd), Microsoft Hyper-V (Get-VM and related cmdlets), VirtualBox (VBoxManage list), VMware Workstation (vmrun list), and KVM/libvirt (virsh list). Flags commands that specifically enumerate running VMs, VM configurations, or VM host resources — common precursors to ransomware targeting of virtualized environments.

high severity high confidence

Data Sources

Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • VMware infrastructure administrators running routine health checks with esxcli or vim-cmd during scheduled maintenance windows
  • Backup and DR solutions (Veeam, Zerto, Commvault) enumerating VMs prior to snapshot-based backup jobs
  • Monitoring agents (vRealize Operations, Prometheus VMware exporter, Nagios XI with VMware plugins) polling VM inventory on a schedule
  • Ansible, Terraform, or PowerCLI automation scripts performing VM lifecycle management or infrastructure-as-code operations
  • IT asset discovery tools (ServiceNow Discovery, Qualys, Rapid7) enumerating virtualized infrastructure during scheduled scans

Sigma rule & cross-platform mapping

The detection logic for Virtual Machine Discovery (T1673) 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:


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 1ESXi VM Enumeration via esxcli

    Expected signal: ESXi shell.log will record esxcli and vim-cmd executions with timestamp and user. If executed via SSH, sshd logs on ESXi will show the originating client IP. Network logs will show SSH connection from management workstation to ESXi management IP on port 22.

  2. Test 2Hyper-V VM Enumeration via PowerShell

    Expected signal: Sysmon Event ID 1 (Process Create) with Image=powershell.exe and CommandLine containing Get-VM and Get-VMHost. Windows Security Event 4688 if process creation auditing with command line is enabled. PowerShell ScriptBlock logging (Event ID 4104) will capture the full command in the Microsoft-Windows-PowerShell/Operational log.

  3. Test 3VirtualBox VM Enumeration via VBoxManage

    Expected signal: Sysmon Event ID 1 with Image=VBoxManage.exe and CommandLine containing 'list vms', 'list runningvms', and 'list hdds'. Windows prefetch file C:\Windows\Prefetch\VBOXMANAGE.EXE-*.pf will be created or updated.

  4. Test 4KVM/libvirt VM Enumeration via virsh

    Expected signal: Linux auditd syscall logs will record execve events for virsh with all arguments if audit rules target /usr/bin/virsh. Syslog will contain process execution records. On endpoints with MDE Linux agent, DeviceProcessEvents will capture virsh execution with CommandLine.


Response Playbook

Triage

  1. Step 1: Identify the account executing the VM enumeration command. Verify whether the account is a known hypervisor admin, service account, or backup agent by cross-referencing the Identity Provider (AD/Azure AD) and checking group membership for VMware/Hyper-V admin groups.
  2. Step 2: Examine the parent process of the enumeration command. Legitimate admin tools (vSphere Client, Ansible) have predictable parent chains. Suspicious parents include cmd.exe spawned from web server processes, unknown binaries, or scripting interpreters with encoded arguments.
  3. Step 3: Check the timing of the enumeration. Was it during a scheduled backup window, change management ticket, or completely outside normal admin hours? Cross-reference with the change management system (ServiceNow/Jira).
  4. Step 4: Look for bulk enumeration patterns — multiple VM discovery commands executed in rapid succession (within 60 seconds) strongly indicate automated scripting rather than interactive admin activity.
  5. Step 5: Search for lateral movement to the hypervisor host itself. Query DeviceLogonEvents for the same account logging into hypervisor management hosts or ESXi directly in the 30 minutes preceding the alert.
  6. Step 6: Check whether the host triggering the alert is itself a VM guest — if an attacker escaped to the hypervisor host, they would then run discovery from that host. Correlate with T1611 (Escape to Host) detections.
  7. Step 7: Examine the initiating process command line for signs of obfuscation (base64 encoding, character substitution, excessive whitespace) which would indicate the enumeration is part of a malicious script rather than direct admin activity.

Containment

  1. If the alert is confirmed malicious, immediately isolate the host where enumeration occurred using Defender for Endpoint's Isolate Device action to prevent further lateral movement to VM guests.
  2. Suspend or disable the account executing VM enumeration commands via Active Directory or Azure AD. Do NOT delete the account as it may preserve forensic evidence of account compromise timeline.
  3. Block network egress from the hypervisor management network segment at the firewall/NSX level to prevent any exfiltration of VM inventory data to external C2 infrastructure.
  4. If the enumeration was executed on an ESXi host directly, revoke SSH access to the ESXi management interface and rotate all ESXi root and service account credentials immediately.
  5. Place all enumerated VMs identified in the discovery output into network isolation mode or move them to a quarantine VLAN while investigation is ongoing.
  6. Revoke vCenter / vSphere Web Client sessions for all active administrator sessions and force re-authentication to identify any concurrent attacker sessions.

Evidence Collection

  1. Export the full process tree for the offending process using Defender for Endpoint's Advanced Hunting: query DeviceProcessEvents for the ProcessId and all child processes, plus the complete InitiatingProcess chain back to the root.
  2. Collect ESXi shell history file: /var/log/shell.log and /var/log/hostd.log from the ESXi host, which contain timestamped records of all esxcli and vim-cmd executions.
  3. For Windows Hyper-V hosts, export the Microsoft-Windows-Hyper-V-Management-PowerShell event log (Applications and Services Logs > Microsoft > Windows > Hyper-V-Management-PowerShell).
  4. Export the vCenter Server audit log from vSphere Web Client (Administration > System Configuration > Events) covering the incident time window, including all API calls and GUI-based VM browsing activity.
  5. Capture a memory image of the offending process if it is still running using Defender for Endpoint's Collect Investigation Package feature, which preserves process memory, loaded DLLs, and network connections.
  6. Pull prefetch files from C:\Windows\Prefetch\ for esxcli.exe, vim-cmd, powershell.exe, VBoxManage.exe to establish first execution timestamps.
  7. Export the Windows Security event log (EventCode 4688) from the affected host filtered to the 2-hour window surrounding the alert to capture all process creations in context.

Escalation Criteria

  • ! Escalate immediately if any VM guests were subsequently shut down or had their disk files accessed — check for ServiceStop (T1489) or WipeFile (T1485) detections on the same host within 2 hours of VM discovery.
  • ! Escalate if the account performing VM enumeration is a service account or non-interactive account that would never legitimately run CLI tools interactively.
  • ! Escalate if VM discovery is followed by file creation events matching ransomware encryptor binaries (e.g., .elf binaries copied to /vmfs/volumes/ on ESXi, or .exe dropped to C:\ProgramData\ on Hyper-V hosts).
  • ! Escalate if network connections to external IPs are observed from the hypervisor host immediately following enumeration — this may indicate C2 communication or data exfiltration of VM inventory.
  • ! Escalate if more than 3 hypervisor hosts show VM enumeration activity within a 30-minute window — this pattern is consistent with automated ransomware spread across infrastructure.
  • ! Escalate if the enumeration was performed by an account that also has domain admin or backup operator privileges, as these could be leveraged for credential theft or shadow copy deletion.

Investigation Guide

Forensic Artifacts

  • > ESXi shell command history: /var/log/shell.log — contains timestamped records of all interactive esxcli and vim-cmd executions with user context
  • > ESXi hostd log: /var/log/hostd.log — records all vSphere API calls including VM enumeration through vCenter or direct API access
  • > ESXi vpxa log: /var/log/vpxa.log — records vCenter agent communications including VM inventory synchronization events
  • > Windows Hyper-V PowerShell event log: Microsoft-Windows-Hyper-V-Management-PowerShell operational log at HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Microsoft-Windows-Hyper-V-Management-PowerShell
  • > Windows Prefetch files: C:\Windows\Prefetch\POWERSHELL.EXE-*.pf, VBOXMANAGE.EXE-*.pf, VMRUN.EXE-*.pf — establish first execution timestamps
  • > Windows Security Event 4688 process creation logs with full command line auditing enabled (requires GPO: Audit Process Creation with command line logging)
  • > Sysmon Event ID 1 process creation logs with ParentProcessId chain to reconstruct full execution ancestry
  • > vCenter Server audit database: vpxd.log and events stored in vCenter DB — records all GUI-based and API-based VM enumeration operations with user attribution
  • > Linux audit log: /var/log/audit/audit.log — execve syscall records for virsh, prlctl, and other CLI tools when auditd rules are configured for hypervisor tools

Tuning Guidance

Create allowlist entries for known VMware admin service accounts (vsphere-admin, backup-svc, veeam-agent) that execute these commands during scheduled backup windows. Add suppression rules based on initiating process path — legitimate tools like Veeam will spawn enumeration from C:\Program Files\Veeam\ while malicious activity typically originates from temp directories, user profiles, or encoded PowerShell. For ESXi environments, tune by source IP: enumeration from jump servers or dedicated management workstations within the management VLAN is expected; enumeration from VM guest subnets is highly suspicious. Consider raising alert priority during non-business hours. For Hyper-V environments, suppress Get-VM calls from processes with digital signatures from Microsoft or known backup vendors. Monitor esxcli and vim-cmd execution frequency — single isolated commands may be legitimate, but 5+ VM enumeration commands within 60 seconds almost always indicates scripted malicious activity.


Hunting Queries

Hunts for ESXi VM enumeration commands launched via SSH clients (plink, PuTTY, WinSCP scripting) which may indicate attackers using legitimate admin tools to proxy commands to ESXi hosts rather than directly invoking tools.

Hunting — KQL
kql
// Hunt for ESXi VM enumeration via SSH remote execution patterns
// Looks for esxcli/vim-cmd invoked via remote tools (ssh, plink, WinSCP scripting)
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("ssh.exe", "plink.exe", "putty.exe", "winscp.exe", "SecureCRT.exe")
    or InitiatingProcessCommandLine has_any ("ssh", "-i ", "-batch")
| where ProcessCommandLine has_any ("esxcli", "vim-cmd", "vmsvc", "esxcfg")
| summarize
    ExecutionCount = count(),
    Commands = make_set(ProcessCommandLine, 20),
    Hosts = make_set(DeviceName, 10),
    FirstSeen = min(Timestamp),
    LastSeen = max(Timestamp)
    by AccountName, InitiatingProcessFileName
| where ExecutionCount >= 2
| order by ExecutionCount desc
Hunting — SPL
spl
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| where match(ParentImage, "(?i)(ssh\.exe|plink\.exe|putty\.exe|winscp\.exe)")
    AND match(CommandLine, "(?i)(esxcli|vim-cmd|vmsvc|esxcfg)")
| stats count as ExecCount, values(CommandLine) as Commands, values(host) as Hosts, min(_time) as FirstSeen, max(_time) as LastSeen by User, ParentImage
| where ExecCount >= 2
| sort - ExecCount

Hunts specifically for encoded or base64-obfuscated PowerShell commands that reference Hyper-V cmdlets, indicating an attacker attempting to evade basic string-match detections while enumerating virtual machines.

Hunting — KQL
kql
// Hunt for PowerShell Hyper-V enumeration with suspicious module imports or encoded commands
// Targets attackers using obfuscated PowerShell to enumerate VMs
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any ("Hyper-V", "Get-VM", "Get-VHD", "Get-VMHost", "Import-Module Hyper-V")
    or ProcessCommandLine matches regex @"(?i)(Get-VM|Get-VHD|Get-VMHost|Get-VMSwitch)"
| extend IsEncoded = iff(ProcessCommandLine has "-enc" or ProcessCommandLine has "-EncodedCommand" or ProcessCommandLine has "-e ", true, false)
| extend IsBase64 = iff(ProcessCommandLine matches regex @"[A-Za-z0-9+/]{50,}={0,2}", true, false)
| where IsEncoded == true or IsBase64 == true
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, IsEncoded, IsBase64, InitiatingProcessFileName
| order by Timestamp desc
Hunting — SPL
spl
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| where match(Image, "(?i)(powershell\.exe|pwsh\.exe)")
    AND match(CommandLine, "(?i)(Get-VM\b|Get-VHD\b|Get-VMHost\b|Hyper-V|Import-Module.*Hyper)")
| eval IsEncoded=if(match(CommandLine, "(?i)(-enc|-EncodedCommand)"), "true", "false")
| eval IsBase64=if(match(CommandLine, "[A-Za-z0-9+/]{50,}={0,2}"), "true", "false")
| where IsEncoded="true" OR IsBase64="true"
| table _time, host, User, CommandLine, IsEncoded, IsBase64, ParentImage
| sort - _time

Correlates VM discovery activity with follow-on VM shutdown or disk file access within a 30-minute window on the same host and account, identifying the full ransomware attack chain pattern used by groups like Cheerscrypt and Qilin.

Hunting — KQL
kql
// Hunt for VM discovery followed by rapid VM shutdown or disk access within 30 minutes
// Correlates T1673 discovery with follow-on destructive activity (T1489, T1485)
let VMDiscovery = DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessCommandLine has_any ("esxcli vm", "vim-cmd vmsvc", "Get-VM", "virsh list", "VBoxManage list vms")
| project DiscoveryTime = Timestamp, DeviceName, AccountName, DiscoveryCommand = ProcessCommandLine;
let VMDestruction = DeviceProcessEvents
| where Timestamp > ago(7d)
| where (
    // VM shutdown commands
    ProcessCommandLine has_any ("vim-cmd vmsvc/power.off", "esxcli vm process kill", "Stop-VM", "virsh destroy", "virsh shutdown")
    // Disk file targeting — ransomware accessing VMDK files
    or ProcessCommandLine has_any (".vmdk", ".vmem", ".vmsn", ".vmsd", "/vmfs/volumes")
)
| project DestructionTime = Timestamp, DeviceName, AccountName, DestructionCommand = ProcessCommandLine;
VMDiscovery
| join kind=inner VMDestruction on DeviceName, AccountName
| where DestructionTime > DiscoveryTime and DestructionTime < datetime_add('minute', 30, DiscoveryTime)
| project DiscoveryTime, DestructionTime, DeviceName, AccountName, DiscoveryCommand, DestructionCommand, ElapsedMinutes = datetime_diff('minute', DestructionTime, DiscoveryTime)
| order by DiscoveryTime desc
Hunting — SPL
spl
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval EventType=case(
    match(CommandLine, "(?i)(esxcli vm|vim-cmd vmsvc/getallvms|Get-VM\b|virsh list|VBoxManage list vms)"), "VM_DISCOVERY",
    match(CommandLine, "(?i)(vim-cmd vmsvc/power\.off|esxcli vm process kill|Stop-VM|virsh destroy|\.vmdk|\.vmem|/vmfs/volumes)"), "VM_DESTRUCTION",
    true(), "OTHER"
)
| where EventType IN ("VM_DISCOVERY", "VM_DESTRUCTION")
| sort host, User, _time
| streamstats window=2 current=true list(EventType) as EventSequence list(_time) as Times list(CommandLine) as Commands by host, User
| eval PairType=mvjoin(EventSequence, "->")
| where PairType="VM_DISCOVERY->VM_DESTRUCTION"
| eval TimeGapMinutes=round((mvindex(Times,1)-mvindex(Times,0))/60, 1)
| where TimeGapMinutes <= 30
| table _time, host, User, TimeGapMinutes, Commands

Atomic Red Team Tests

Test 1 ESXi VM Enumeration via esxcli
linux

Simulates an adversary enumerating running virtual machines on an ESXi hypervisor using the esxcli command-line tool. This is the primary method used by Cheerscrypt, Play, and other ransomware families targeting VMware infrastructure.

Command

bash
ssh root@<esxi-host> 'esxcli vm process list && vim-cmd vmsvc/getallvms && esxcli storage vmfs volume list'

Cleanup

bash
No cleanup required — read-only enumeration command

Expected Telemetry

ESXi shell.log will record esxcli and vim-cmd executions with timestamp and user. If executed via SSH, sshd logs on ESXi will show the originating client IP. Network logs will show SSH connection from management workstation to ESXi management IP on port 22.

Expected Detection

Alert on process creation of ssh.exe with command line referencing esxcli or vim-cmd on the source workstation. On ESXi itself, shell.log ingestion via syslog forwarding to SIEM will trigger alerts on esxcli vm process list pattern.

Test 2 Hyper-V VM Enumeration via PowerShell
windows

Simulates an adversary enumerating all virtual machines on a Windows Hyper-V host using PowerShell cmdlets. Tests detection of Get-VM and related Hyper-V module commands.

Command

powershell
powershell.exe -Command "Import-Module Hyper-V; Get-VM | Select-Object Name,State,ProcessorCount,MemoryAssigned; Get-VMHost | Select-Object ComputerName,VirtualMachinePath; Get-VHD -Path (Get-VM | Get-VMHardDiskDrive).Path | Select-Object Path,Size,FileSize"

Cleanup

powershell
No cleanup required — read-only PowerShell query

Expected Telemetry

Sysmon Event ID 1 (Process Create) with Image=powershell.exe and CommandLine containing Get-VM and Get-VMHost. Windows Security Event 4688 if process creation auditing with command line is enabled. PowerShell ScriptBlock logging (Event ID 4104) will capture the full command in the Microsoft-Windows-PowerShell/Operational log.

Expected Detection

Alert fires on DeviceProcessEvents query matching Get-VM or Get-VMHost in PowerShell command line. SPL query matches Sysmon EventCode=1 with CommandLine matching Get-VM pattern.

Test 3 VirtualBox VM Enumeration via VBoxManage
windows

Simulates VM discovery on a host running Oracle VirtualBox using VBoxManage CLI, enumerating both registered and running VMs including their storage attachments.

Command

powershell
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms && "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms && "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list hdds

Cleanup

powershell
No cleanup required — read-only enumeration

Expected Telemetry

Sysmon Event ID 1 with Image=VBoxManage.exe and CommandLine containing 'list vms', 'list runningvms', and 'list hdds'. Windows prefetch file C:\Windows\Prefetch\VBOXMANAGE.EXE-*.pf will be created or updated.

Expected Detection

Alert fires on process creation of VBoxManage.exe with CommandLine matching 'list vms' or 'list runningvms' patterns in both KQL and SPL queries.

Test 4 KVM/libvirt VM Enumeration via virsh
linux

Simulates VM enumeration on a Linux KVM hypervisor using virsh, listing all running domains and their resource allocation. This test covers Linux hypervisor environments running KVM with libvirt.

Command

bash
virsh list --all && virsh nodeinfo && virsh domstats --raw && virsh net-list --all

Cleanup

bash
No cleanup required — read-only commands

Expected Telemetry

Linux auditd syscall logs will record execve events for virsh with all arguments if audit rules target /usr/bin/virsh. Syslog will contain process execution records. On endpoints with MDE Linux agent, DeviceProcessEvents will capture virsh execution with CommandLine.

Expected Detection

Alert fires on process creation of virsh with command line matching 'list', 'nodeinfo', or 'domstats' patterns. Linux auditd integration with SIEM triggers on execve records for virsh binary.

Related Detections

Tactic Hub