Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify that you're running under a VM?

Is there a way to identify, from within a VM, that your code is running inside a VM?

I guess there are more or less easy ways to identify specific VM systems, especially if the VM has the provider's extensions installed (such as for VirtualBox or VMWare). But is there a general way to identify that you are not running directly on the CPU?

like image 775
Wilson Avatar asked Sep 02 '08 13:09

Wilson


People also ask

How can I tell what VM host is running?

Go to the working directory of the Virtual machine. grep -i hostname vmware. log to determine the host on which the virtual machine is running.

Can we detect virtual machine?

Both Sentinel RMS License Manager and standalone components (since v8. 4.0 and higher) are capable of detecting if they are running within a virtual environment. You can use this feature to control or prevent your licensed applications from being used within a VM.


1 Answers

A lot of the research on this is dedicated to detecting so-called "blue pill" attacks, that is, a malicious hypervisor that is actively attempting to evade detection.

The classic trick to detect a VM is to populate the ITLB, run an instruction that must be virtualized (which necessarily clears out such processor state when it gives control to the hypervisor), then run some more code to detect if the ITLB is still populated. The first paper on it is located here, and a rather colorful explanation from a researcher's blog and alternative Wayback Machine link to the blog article (images broken).

Bottom line from discussions on this is that there is always a way to detect a malicious hypervisor, and it's much simpler to detect one that isn't trying to hide.

like image 135
JawnV6 Avatar answered Sep 28 '22 17:09

JawnV6