qm (QEMU Machine) is the primary command-line tool for managing QEMU/KVM virtual machines in Proxmox VE. It provides comprehensive VM lifecycle management including creation, modification, snapshotting, and guest agent interaction. Adversaries can abuse qm for lateral movement via guest agent commands, data exfiltration through snapshots, and VM manipulation for impact.
/usr/sbin/qmLists all QEMU virtual machines on the current node with their VMID, name, status, memory, and boot disk.
qm list
qm listqm list | grep runningDisplay full configuration of a VM including hardware, network, and storage settings.
qm config {vmid}
qm config 100qm config 100 --currentList all snapshots for a VM showing the snapshot tree.
qm listsnapshot {vmid}
Display the full QEMU command line used to start a VM.
qm showcmd {vmid}
Ping the QEMU guest agent to verify it's responsive.
qm agent {vmid} ping
for vm in $(qm list | awk 'NR>1 && $3=="running" {print $1}'); do echo -n "VM $vm: "; qm agent $vm ping 2>&1; doneExecute arbitrary commands inside a running VM through the QEMU guest agent.
qm guest exec {vmid} -- /bin/bash -c "command"
qm guest exec 102 -- cat /etc/shadowqm guest exec 102 -- /bin/bash -c "whoami && id"qm guest exec 103 -- powershell.exe -Command "Get-Process"Write files to a guest VM through the QEMU guest agent using base64-encoded content.
qm guest cmd {vmid} file-write /path/to/file base64content
qm guest cmd 102 file-write /tmp/payload.sh $(base64 -w0 payload.sh)Access the QEMU monitor interface for low-level VM control.
qm monitor {vmid}
qm monitor 100echo "info status" | qm monitor 100Read files directly from a guest VM through the QEMU guest agent.
qm guest cmd {vmid} file-read /path/to/file
qm guest cmd 102 file-read /etc/passwdqm guest cmd 103 file-read "C:\Windows\System32\config\SAM"Create a snapshot of a VM preserving its current state including memory.
qm snapshot {vmid} {snapname}
qm snapshot 100 pre-attackqm snapshot 100 backup --vmstateStop a running virtual machine (ungraceful shutdown).
qm stop {vmid}
qm stop 100for vm in $(qm list | awk 'NR>1 {print $1}'); do qm stop $vm; donePermanently destroy a VM and all its data.
qm destroy {vmid}
qm destroy 100 --purgeDump the cloud-init user-data configuration for a VM.
qm cloudinit dump {vmid} user
qm cloudinit dump 100 userqm cloudinit dump 100 network