Skip to content

Commit bb2fbcc

Browse files
authored
Merge pull request #298 from kernelwernel/dev
Dev
2 parents 8200aaa + 29ba0f0 commit bb2fbcc

File tree

5 files changed

+308
-657
lines changed

5 files changed

+308
-657
lines changed

CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ set(TARGET "vmaware")
5757
if (MSVC)
5858
if(CMAKE_BUILD_TYPE MATCHES "Debug")
5959
MESSAGE(STATUS "Build set to debug mode")
60-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Od")
6160
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
6261
MESSAGE(STATUS "Build set to release mode")
6362
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2")
@@ -120,10 +119,10 @@ if (NOT MSVC)
120119
install(TARGETS ${TARGET} DESTINATION ${CMAKE_SOURCE_DIR})
121120
endif()
122121
elseif(MSVC)
123-
set(CMAKE_INSTALL_PREFIX "C:\\Program Files\\YourApplication")
124-
install(TARGETS ${TARGET} RUNTIME DESTINATION "bin")
125-
126-
set(HEADER_INSTALL_PATH "C:\\Program Files (x86)\\YourLibrary\\include")
127-
install(FILES "src/vmaware.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
128-
install(FILES "src/vmaware_MIT.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
122+
set(CMAKE_INSTALL_PREFIX "C:\\Program Files\\YourApplication")
123+
install(TARGETS ${TARGET} RUNTIME DESTINATION "bin")
124+
125+
set(HEADER_INSTALL_PATH "C:\\Program Files (x86)\\YourLibrary\\include")
126+
install(FILES "src/vmaware.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
127+
install(FILES "src/vmaware_MIT.hpp" DESTINATION "${HEADER_INSTALL_PATH}")
129128
endif()

docs/documentation.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main() {
9999
* This is just an example to show that you can use a combination of
100100
* different flags and non-technique flags with the above examples.
101101
*/
102-
bool is_vm9 = VM::detect(VM::NO_MEMO, VM::HIGH_THRESHOLD, VM::DISABLE(VM::RDTSC, VM::VMID));
102+
bool is_vm9 = VM::detect(VM::DEFAULT, VM::NO_MEMO, VM::HIGH_THRESHOLD, VM::DISABLE(VM::RDTSC, VM::VMID));
103103
}
104104
```
105105

@@ -480,7 +480,6 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
480480
| `VM::INTEL_THREAD_MISMATCH` | Check for Intel CPU thread count database if it matches the system's thread count | | 95% | | | | |
481481
| `VM::XEON_THREAD_MISMATCH` | Same as above, but for Xeon Intel CPUs | | 95% | | | | |
482482
| `VM::NETTITUDE_VM_MEMORY` | Check for memory regions to detect VM-specific brands | Windows | 100% | | | | |
483-
| `VM::CPUID_BITSET` | Check for CPUID technique by checking whether all the bits equate to more than 4000 | | 25% | | | | |
484483
| `VM::CUCKOO_DIR` | Check for cuckoo directory using crt and WIN API directory functions | Windows | 30% | | | | |
485484
| `VM::CUCKOO_PIPE` | Check for Cuckoo specific piping mechanism | Windows | 30% | | | | |
486485
| `VM::HYPERV_HOSTNAME` | Check for default Azure hostname format regex (Azure uses Hyper-V as their base VM brand) | Windows, Linux | 30% | | | | |
@@ -510,17 +509,17 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
510509
| `VM::VM_SIDT` | Check for unknown IDT base address | Windows | 100% | | | | |
511510
| `VM::HDD_SERIAL` | Check for serial numbers of virtual disks | Windows | 100% | | | | |
512511
| `VM::PORT_CONNECTORS` | Check for physical connection ports | Windows | 25% | | | | This technique is known to false flag on devices like Surface Pro |
513-
| `VM::GPU` | Check for GPU capabilities and specific GPU signatures related to VMs | Windows | 100% | Admin | | | Admin only needed for some heuristics |
512+
| `VM::GPU_CAPABILITIES` | Check for GPU capabilities related to VMs | Windows | 100% | Admin | | | Admin only needed for some heuristics |
513+
| `VM::GPU_VM_STRINGS` | Check for specific GPU string signatures related to VMs | Windows | 100% | | | | |
514514
| `VM::VM_DEVICES` | Check for VM-specific devices | Windows | 45% | | | | |
515-
| `VM::VM_MEMORY` | Check for specific VM memory traces in certain processes | Windows | 65% | | | | |
516-
| `VM::IDT_GDT_MISMATCH` | Check if the IDT and GDT base virtual addresses mismatch between different CPU cores when called from usermode under a root partition | Windows | 50% | | | | |
515+
| `VM::IDT_GDT_SCAN` | Check if the IDT and GDT virtual base addresses are equal across different CPU cores when not running under Hyper-V | Windows | 50% | | | | |
517516
| `VM::PROCESSOR_NUMBER` | Check for number of processors | Windows | 50% | | | | |
518517
| `VM::NUMBER_OF_CORES` | Check for number of cores | Windows | 50% | | | | |
519518
| `VM::ACPI_TEMPERATURE` | Check for device's temperature | Windows | 25% | | | | |
520519
| `VM::PROCESSOR_ID` | Check if any processor has an empty Processor ID using SMBIOS data | Windows | 25% | | | | |
521520
| `VM::SYS_QEMU` | Check for existence of "qemu_fw_cfg" directories within /sys/module and /sys/firmware | Linux | 70% | | | | |
522521
| `VM::LSHW_QEMU` | Check for QEMU string instances with lshw command | Linux | 80% | | | | |
523-
| `VM::VIRTUAL_PROCESSORS` | Check if the number of maximum virtual processors matches the maximum number of logical processors | Windows | 50% | | | | |
522+
| `VM::VIRTUAL_PROCESSORS` | Check if the number of virtual and logical processors are reported correctly by the system | Windows | 50% | | | | |
524523
| `VM::HYPERV_QUERY` | Check if a call to NtQuerySystemInformation with the 0x9f leaf fills a _SYSTEM_HYPERVISOR_DETAIL_INFORMATION structure | Windows | 100% | | | | |
525524
| `VM::BAD_POOLS` | Check for system pools allocated by hypervisors | Windows | 80% | | | | |
526525
| `VM::AMD_SEV` | Check for AMD-SEV MSR running on the system | Linux and MacOS | 50% | Admin | | | |
@@ -581,7 +580,7 @@ This is the table of all the brands the lib supports.
581580
| OpenBSD VMM | `brands::BSD_VMM` | Hypervisor (type 2) | |
582581
| Intel HAXM | `brands::INTEL_HAXM` | Hypervisor (type 1) | |
583582
| Unisys s-Par | `brands::UNISYS` | Partitioning Hypervisor | |
584-
| Lockheed Martin LMHS | `brands::LMHS` | Hypervisor (unknown type) | Yes, you read that right. The lib can detect VMs running on US military fighter jets, apparently |
583+
| Lockheed Martin LMHS | `brands::LMHS` | Hypervisor (unknown type) | Yes, you read that right. The lib can detect VMs running on US military fighter jets, apparently. |
585584
| Cuckoo | `brands::CUCKOO` | Sandbox | |
586585
| BlueStacks | `brands::BLUESTACKS` | Emulator | |
587586
| Jailhouse | `brands::JAILHOUSE` | Partitioning Hypervisor | |
@@ -590,16 +589,16 @@ This is the table of all the brands the lib supports.
590589
| Microsoft Azure Hyper-V | `brands::AZURE_HYPERV` | Hypervisor (type 1) | |
591590
| Xbox NanoVisor (Hyper-V) | `brands::NANOVISOR` | Hypervisor (type 1) | |
592591
| SimpleVisor | `brands::SIMPLEVISOR` | Hypervisor (type 1) | |
593-
| Hyper-V artifact (not an actual VM) | `brands::HYPERV_ARTIFACT` | Unknown | |
592+
| Hyper-V artifact (not an actual VM) | `brands::HYPERV_ARTIFACT` | Unknown | Windows Hyper-V has a tendency to modify host hardware values with VM values. In other words, this brand signifies that you're running on a host system, but the Hyper-V that's installed (either by default or manually by the user) is misleadingly making the whole system look like it's in a VM when in reality it's not. <br><br> For more information, refer to [this graph](https://github.com/kernelwernel/VMAware/blob/main/assets/hyper-x/v5/Hyper-X_version_5.drawio.png). |
594593
| User-mode Linux | `brands::UML` | Paravirtualised/Hypervisor (type 2) | |
595594
| IBM PowerVM | `brands::POWERVM` | Hypervisor (type 1) | |
596595
| OpenStack (KVM) | `brands::OPENSTACK` | Hypervisor (type 1) | |
597596
| KubeVirt (KVM) | `brands::KUBEVIRT` | Hypervisor (type 1) | |
598597
| AWS Nitro System EC2 (KVM-based) | `brands::AWS_NITRO` | Hypervisor (type 1) | |
599598
| Podman | `brands::PODMAN` | Container | |
600-
| WSL | `brands::WSL` | Hybrid Hyper-V (type 1 and 2) | The type is debatable, it's not exactly clear |
599+
| WSL | `brands::WSL` | Hybrid Hyper-V (type 1 and 2) | The type is debatable, it's not exactly clear. |
601600
| OpenVZ | `brands::OPENVZ` | Container | |
602-
| ANY.RUN | N/A | Sandbox | Removed from the lib, available only in the CLI |
601+
| ANY.RUN | N/A | Sandbox | Removed from the lib, available only in the CLI due to ethical reasons. |
603602
| Barevisor | `brands::BAREVISOR` | Hypervisor (type 1) | |
604603
| HyperPlatform | `brands::HYPERPLATFORM` | Hypervisor (type 1) | |
605604
| MiniVisor | `brands::MINIVISOR` | Hypervisor (type 1) | |

src/cli.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ bool is_unsupported(VM::enum_flags flag) {
362362
case VM::ODD_CPU_THREADS:
363363
case VM::INTEL_THREAD_MISMATCH:
364364
case VM::XEON_THREAD_MISMATCH:
365-
case VM::CPUID_BITSET:
366365
case VM::HYPERV_HOSTNAME:
367366
case VM::GENERAL_HOSTNAME:
368367
case VM::BLUESTACKS_FOLDERS:
@@ -439,7 +438,6 @@ bool is_unsupported(VM::enum_flags flag) {
439438
case VM::INTEL_THREAD_MISMATCH:
440439
case VM::XEON_THREAD_MISMATCH:
441440
case VM::NETTITUDE_VM_MEMORY:
442-
case VM::CPUID_BITSET:
443441
case VM::CUCKOO_DIR:
444442
case VM::CUCKOO_PIPE:
445443
case VM::HYPERV_HOSTNAME:
@@ -453,8 +451,9 @@ bool is_unsupported(VM::enum_flags flag) {
453451
case VM::VM_SIDT:
454452
case VM::HDD_SERIAL:
455453
case VM::PORT_CONNECTORS:
456-
case VM::GPU:
457-
case VM::IDT_GDT_MISMATCH:
454+
case VM::GPU_VM_STRINGS:
455+
case VM::GPU_CAPABILITIES:
456+
case VM::IDT_GDT_SCAN:
458457
case VM::PROCESSOR_NUMBER:
459458
case VM::NUMBER_OF_CORES:
460459
case VM::ACPI_TEMPERATURE:
@@ -494,7 +493,6 @@ bool is_unsupported(VM::enum_flags flag) {
494493
case VM::ODD_CPU_THREADS:
495494
case VM::INTEL_THREAD_MISMATCH:
496495
case VM::XEON_THREAD_MISMATCH:
497-
case VM::CPUID_BITSET:
498496
case VM::CPUID_SIGNATURE:
499497
case VM::KVM_BITMASK:
500498
case VM::KGT_SIGNATURE:
@@ -635,7 +633,7 @@ std::string vm_description(const std::string& vm_brand) {
635633
{ brands::AZURE_HYPERV, "Azure Hyper-V is Microsoft's cloud-optimized hypervisor variant powering Azure VMs. Implements Azure-specific virtual devices like NVMe Accelerated Networking and vTPMs. Supports nested virtualization for running Hyper-V/containers within Azure VMs, enabling cloud-based CI/CD pipelines and dev/test environments." },
636634
{ brands::NANOVISOR, "NanoVisor is a Hyper-V modification serving as the host OS of Xbox's devices: the Xbox System Software. It contains 2 partitions: the \"Exclusive\" partition is a custom VM for games, while the other partition, called the \"Shared\" partition is a custom VM for running multiple apps including the OS itself. The OS was based on Windows 8 Core at the Xbox One launch in 2013." },
637635
{ brands::SIMPLEVISOR, "SimpleVisor is a minimalist Intel VT-x hypervisor by Alex Ionescu for Windows/Linux research. Demonstrates EPT-based memory isolation and hypercall handling. Used to study VM escapes and hypervisor rootkits, with hooks for intercepting CR3 changes and MSR accesses." },
638-
{ brands::HYPERV_ARTIFACT, "The CLI detected Hyper-V operating as a Type 1 hypervisor, not as a guest virtual machine. Althought your hardware/firmware signatures match Microsoft's Hyper-V architecture, we determined that you're running on baremetal, with the help of our \"Hyper-X\" mechanism that differentiates between the root partition (host OS) and guest VM environments. This prevents false positives, as Windows sometimes runs under Hyper-V (type 1) hypervisor." },
636+
{ brands::HYPERV_ARTIFACT, "The CLI detected Hyper-V operating as a Type 1 hypervisor, not as a guest virtual machine. Althought your hardware/firmware signatures match Microsoft's Hyper-V architecture, we determined that you're running on baremetal, with the help of our \"Hyper-X\" mechanism that differentiates between the root partition (host OS) and guest VM environments. This prevents false positives, as Windows sometimes runs under Hyper-V (type 1) hypervisor." },
639637
{ brands::UML, "User-Mode Linux (UML) allows running Linux kernels as user-space processes using ptrace-based virtualization. Primarily used for kernel debugging and network namespace testing. Offers lightweight isolation without hardware acceleration, but requires host/guest kernel version matching for stable operation." },
640638
{ brands::POWERVM, "IBM PowerVM is a type 1 hypervisor for POWER9/10 systems, supporting Live Partition Mobility and Shared Processor Pools. Implements VIOS (Virtual I/O Server) for storage/networking virtualization, enabling concurrent AIX, IBM i, and Linux workloads with RAS features like predictive failure analysis." },
641639
{ brands::GCE, "Google Compute Engine (GCE) utilizes KVM-based virtualization with custom Titanium security chips for hardware root of trust. Features live migration during host maintenance and shielded VMs with UEFI secure boot. Underpins Google Cloud's Confidential Computing offering using AMD SEV-SNP memory encryption." },
@@ -943,7 +941,6 @@ void general() {
943941
checker(VM::INTEL_THREAD_MISMATCH, "Intel thread count mismatch");
944942
checker(VM::XEON_THREAD_MISMATCH, "Intel Xeon thread count mismatch");
945943
checker(VM::NETTITUDE_VM_MEMORY, "VM memory regions");
946-
checker(VM::CPUID_BITSET, "CPUID bitset");
947944
checker(VM::CUCKOO_DIR, "Cuckoo directory");
948945
checker(VM::CUCKOO_PIPE, "Cuckoo pipe");
949946
checker(VM::HYPERV_HOSTNAME, "Hyper-V Azure hostname");
@@ -973,8 +970,9 @@ void general() {
973970
checker(VM::VM_SIDT, "VM SIDT");
974971
checker(VM::HDD_SERIAL, "HDD serial number");
975972
checker(VM::PORT_CONNECTORS, "physical connection ports");
976-
checker(VM::GPU, "GPU capabilities");
977-
checker(VM::IDT_GDT_MISMATCH, "IDT GDT mismatch");
973+
checker(VM::GPU_CAPABILITIES, "GPU capabilities");
974+
checker(VM::GPU_VM_STRINGS, "GPU strings");
975+
checker(VM::IDT_GDT_SCAN, "IDT GDT consistency");
978976
checker(VM::PROCESSOR_NUMBER, "processor count");
979977
checker(VM::NUMBER_OF_CORES, "CPU core count");
980978
checker(VM::ACPI_TEMPERATURE, "thermal devices");
@@ -1233,7 +1231,7 @@ int main(int argc, char* argv[]) {
12331231
{ "--compact", COMPACT },
12341232
{ "--mit", MIT },
12351233
{ "--enums", ENUMS },
1236-
{ "--no-color", NO_ANSI }
1234+
{ "--no-ansi", NO_ANSI }
12371235
}};
12381236

12391237
std::string potential_null_arg = "";

0 commit comments

Comments
 (0)