Members of this group can manage VMs ( Virtual Machines ) on a Hyper-V host, including operations such create, delete, start, stop and modify a given VM
Even though they do not belong to the Administrators group, this type of delegation is quite sensitive as most of the operations are carried out by the vmms.exe ( Virtual Machines Management Service ), which usually runs as LOCAL SYSTEM
Enumeration
Listing the Groups to which the Current User belongs
whoami /groupsnet user <USER>
Members of Hyper-V Admins
net localgroup "Hyper-V Admins"
Code Execution as LOCAL SYSTEM
Workflow
In this case, we basically abuse a DACL restoration carried out by vmms.exe, which is running as LOCAL SYSTEM, when a VM is deleted
Bear in mind that whenever a VM is removed from the Hyper-v host, the vmss.exe steps in and perfoms a permissions restoration on the VHDX associated with the virtual machine in question
As stated, since this service is running as LOCAL SYSTEM, the action is carried out by the latter, so the restoration will most likely be carried out properly, and then we will have probably FULL CONTROL over the virtual disk
So, in order to abuse this behavior, we can proceed in the following way →
First, we create a new VM on the Hyper-V host by leveraging the existing rights of the controlled user account which belongs to the Hyper-V administrators group
During the VM creation, a Virtual Hard Disk ( VHDX ) is also created and located on a system path specified by the operator
Right after, we remove the given VHDX and create an NTFS Hard Link, named as the deleted VHDX and located in the same place, pointing to a sensitive resource that we want to compromise
The resource in question would be a binary of a service running as LOCAL SYSTEM
Once we delete the entire VM from the host, as we mentioned earlier, the vmms.exe service will carry out a DACL restoration over the VHDX resource associated with the VM
Since this VHDX is a NTFS Hard Link pointing to another resource, the virtualization service will restore the DACL of the given resource, namely the binary of a service running as LOCAL SYSTEM
Having FULL CONTROL over the sensitive binary, we can replace it with a malicious binary, then, we restart the service in question and the payload will be executed as LOCAL SYSTEM
Requirements
The controlled user account must be a member of the Hyper-V administrators group
Hyper-V installed on the given host and VMMS.exe service running
The target must not be patched against this abuse technique
This vector was mitigated on March 2020 Windows Security Updates, which changed behavior related to hard links
Right after the VM deletion, remember that vmms.exe will restore the DACL of the given resource, so we could proceed as follows to take ownership of the service’s binary