
Thermal Zone Temperature
The temperature sensor is used to know the current temperature of a machine. In a non-virtualized environment, the function returns valid support and output like: “25.05 C: 77.09 F: 298.2K”. But for a fully virtualized environment, the return is “MSAcpi_ThermalZoneTemperature not supported” because this feature is not supported on virtualized processors.
Interestingly, this method is not valid. Not all Windows machines will support this method due to incompatibility with thermal zone sensors. It is a BIOS function. Sometimes the BIOS manufacturer provides dlls that can be referenced to call the required function and return the details.
Many malware authors use it to detect virtual machines, but it frequently fails due to lack of vendor support.
Code Snippets
Description
If the return is “MSAcpi_ThermalZoneTemperature not supported, it means you are in a virtualized environment.
Reference : https://gist.github.com/teixeira0xfffff/36293713c254c69a7ba2353e8d64afce#file-msacpi_thermalzonetemperature-ps1
function Get-AntiVMwithTemperature {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
$valorTempKelvin = $t.CurrentTemperature / 10
$valorTempCelsius = $valorTempKelvin - 273.15
$valorTempFahrenheit = (9/5) * $valorTempCelsius + 32
return $valorTempCelsius.ToString() + " C : " + $valorTempFahrenheit.ToString() + " F : " + $valorTempKelvin + "K"
}
Detection Rules
rule Detect_AntiVMWithTemperature {
meta:
description = "Rue to detect AntiVMwithTemperature technique"
author = "Thibault Seret"
date = "2020-09-26"
strings:
$s1 = {72 6f 6f 74 5c 57 4d 49}
// root\WMI
$s2 = {53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 4d 53 41 63 70 69 5f 54 68 65 72 6d 61 6c 5a 6f 6e 65 54 65 6d 70 65 72 61 74 75 72 65}
// SELECT * FROM MSAcpi_ThermalZoneTemperature
$s3 = {43 75 72 72 65 6e 74 54 65 6d 70 65 72 61 74 75 72 65}
// CurrentTemperature
condition:
all of them