Virtualization/Sandbox Evasion
Adversaries may employ various means to detect and avoid virtualization and analysis environments. This may include changing behaviors based on the results of checks for the presence of artifacts indicative of a virtual machine environment (VME) or sandbox. If the adversary detects a VME, they may alter their malware to disengage from the victim or conceal the core functions of the implant. They may also search for VME artifacts before dropping secondary or additional payloads. Methods include checking for security monitoring tools, system artifacts associated with virtualization, legitimate user activity patterns, and time-based anomalies.
let VMDetectCommands = dynamic(["MSAcpi_ThermalZoneTemperature", "Win32_Fan", "Win32_ComputerSystem", "VMwareHostOpen.exe", "VBoxService", "vmtoolsd", "vmwaretray", "vboxservice", "qemu-ga", "vmusrvc", "vmsrvc"]);
let VMDetectRegistry = dynamic(["HKLM\\SOFTWARE\\VMware", "HKLM\\SOFTWARE\\Oracle\\VirtualBox", "SYSTEM\\CurrentControlSet\\Services\\VBoxGuest", "SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_15AD", "SYSTEM\\CurrentControlSet\\Enum\\PCI\\VEN_80EE"]);
let SandboxDetectTools = dynamic(["wireshark", "procmon", "procexp", "fiddler", "x64dbg", "x32dbg", "ollydbg", "ida64", "idaq", "windbg", "regmon", "filemon", "autoruns"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has_any (VMDetectCommands)
or ProcessCommandLine has_any (VMDetectRegistry)
or (FileName =~ "wmic.exe" and ProcessCommandLine has_any ("MSAcpi_ThermalZoneTemperature", "Win32_Fan", "Win32_ComputerSystem", "Win32_BaseBoard", "Win32_BIOS"))
or (FileName =~ "reg.exe" and ProcessCommandLine has_any ("VMware", "VirtualBox", "VBoxGuest", "QEMU"))
or (ProcessCommandLine has "tasklist" and ProcessCommandLine has_any (SandboxDetectTools))
| extend WMICheck = ProcessCommandLine has_any ("MSAcpi_ThermalZoneTemperature", "Win32_Fan", "Win32_ComputerSystem", "Win32_BIOS")
| extend RegistryCheck = ProcessCommandLine has_any ("VMware", "VirtualBox", "VBoxGuest", "QEMU") and FileName =~ "reg.exe"
| extend ProcessScan = ProcessCommandLine has "tasklist" and ProcessCommandLine has_any (SandboxDetectTools)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
WMICheck, RegistryCheck, ProcessScan
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- System administrators running WMI queries for hardware inventory and asset management
- IT automation tools (SCCM, Intune, ManageEngine) collecting system hardware information via WMI
- Security teams running sandbox detection tests as part of adversary emulation exercises
- System monitoring software that queries hardware sensors for health dashboards
References (6)
- https://attack.mitre.org/techniques/T1497/
- https://drive.google.com/file/d/1t0jn3xr4ff2fR30oQAUn_RsWSnMpOAQc/edit
- https://unit42.paloaltonetworks.com/ups-observations-on-cve-2015-3113-prior-zero-days-and-the-pirpi-payload/
- https://securingtomorrow.mcafee.com/other-blogs/mcafee-labs/stopping-malware-fake-virtual-machine/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1497/T1497.md
- https://github.com/a0rtega/pafish
Unlock Pro Content
Get the full detection package for T1497 including response playbook, investigation guide, and atomic red team tests.