Skip to content

Dev to main #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ]
}
]
}
49 changes: 31 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
The library is:
- Very easy to use
- Cross-platform (Windows + MacOS + Linux)
- Features up to 120+ unique VM detection techniques [[list](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#flag-table)]
- Features up to 130+ unique VM detection techniques [[list](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#flag-table)]
- Features the most cutting-edge techniques
- Able to detect 60+ VM brands including VMware, VirtualBox, QEMU, Hyper-V, and much more [[list](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#brand-table)]
- Able to detect 65+ VM brands including VMware, VirtualBox, QEMU, Hyper-V, and much more [[list](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#brand-table)]
- Able to beat VM hardeners
- Compatible with x86 and ARM, with backwards compatibility for 32-bit systems
- Very flexible, with total fine-grained control over which techniques get executed
Expand Down Expand Up @@ -83,8 +83,6 @@ git clone https://github.com/kernelwernel/VMAware
cd VMAware
```

<br>

### FOR LINUX:
```bash
sudo dnf/apt/yum update -y # change this to whatever your distro is
Expand All @@ -107,6 +105,16 @@ sudo make install
cmake -S . -B build/ -G "Visual Studio 16 2019"
```

<br>


### Vcpkg installation
```bash
# Note: the package is MIT. The GPL version doesn't exist.
vcpkg install vmaware-vm-detection
```

<br>

### CMake installation
```cmake
Expand Down Expand Up @@ -136,12 +144,6 @@ endif()
The module file and function version is located [here](auxiliary/vmaware_download.cmake)


### Vcpkg installation
```
vcpkg install vmaware-vm-detection
```


<br>

## Documentation 📒
Expand All @@ -165,7 +167,9 @@ You can view the full docs [here](docs/documentation.md). All the details such a

> It's designed for security researchers, VM engineers, anticheat developers, and pretty much anybody who needs a practical and rock-solid VM detection mechanism in their project. For example, the library is suitable if you're making a VM and you're testing the effectiveness of concealing itself. If you're a proprietary software developer, the library is useful to thwart against reverse engineers. If you're a malware analyst and you want to check the concealment capability of your VM, this would be the perfect tool to benchmark how well-concealed your VM is against malware.
>
> Additionally, software could adjust the behaviour of their program base on the detected environment. It could be useful for debugging and testing purposes, system administrators could manage configurations differently, and some applications might want to restrict usage in VMs to prevent unauthorized distribution or testing.
> Additionally, software could adjust the behaviour of their program based on the detected environment. It could be useful for debugging and testing purposes, while system administrators could manage configurations differently. Additionally, some applications might want to legally restrict usage in VMs as a license clause to prevent unauthorized distribution or testing.
>
> There are also projects that utilise our tool such as [Hypervisor-Phantom](https://github.com/Scrut1ny/Hypervisor-Phantom?tab=readme-ov-file), which is an advanced malware analysis project that we helped strengthen their hypervisor environment and undetectability.

</details>

Expand All @@ -175,20 +179,28 @@ You can view the full docs [here](docs/documentation.md). All the details such a

> There's already loads of projects that have the same goal such as
<a href="https://github.com/CheckPointSW/InviZzzible">InviZzzible</a>, <a href="https://github.com/a0rtega/pafish">pafish</a> and <a href="https://github.com/LordNoteworthy/al-khaser">Al-Khaser</a>. But the difference between the aforementioned projects is that they don't provide a programmable interface to interact with the detection mechanisms, on top of having little to no support for non-Windows systems.
> Pafish and InviZzzible have been abandoned for years, while Al-Khaser does receive updates and has a wide scope of detection that includes anti-debuggers, anti-injection, and so on, but the VM detections are not sophisticated enough to be practically applied to real-world scenarios.
> Pafish and InviZzzible have been abandoned for years, while Al-Khaser does receive updates and has a wide scope of detection that includes anti-debuggers, anti-injection, and so on, but the VM detections are not sophisticated enough to be practically applied to real-world scenarios while not providing enough VM detection techniques. An additional issue is that they are all GPL projects.
>
> I wanted the core detection techniques to be accessible programmatically in a cross-platform way for everybody to get something useful out of it rather than providing just a CLI tool. It also contains a larger quantity of techniques, so it's basically just a VM detection library and tool on steroids with maximum flexibility.
> I wanted the core detection techniques to be accessible programmatically in a cross-platform way for everybody to get something useful out of it rather than providing just a CLI tool. It also contains a larger quantity of techniques, so it's basically just a VM detection framework on steroids with maximum flexibility.

</details>


<details>
<summary>How does it compare to paid VM detection libraries? Wouldn't it make it inferior for having it open source?</summary>
<summary>How does it compare to paid VM detection libraries?</summary>
<br>

> There are several paid software solutions available for protecting software licenses from reverse engineering or cracking, such as <a href="https://docs.sentinel.thalesgroup.com/home.htm">Thales' Sentinel RMS</a> and <a href="https://vmpsoft.com/">VMProtect</a>. These tools include VM detection as part of their feature set, though their primary focus is not VM detection unlike this project.
>
> Speaking of which, the only downside to VMAware is that it's fully open source, which makes the job of bypassers easier compared to having it closed source. However, I'd argue that's a worthy tradeoff by having as many VM detection techniques in an open and interactive way, including having valuable community feedback to make the library more effective and accurate.

</details>

<details>
<summary>Wouldn't it make it inferior for having it open source?</summary>
<br>

> The only downside to VMAware is that it's fully open source, which makes the job of bypassers easier compared to having it closed source. However, I'd argue that's a worthy tradeoff by having as many VM detection techniques in an open and interactive way rather than trying to obfuscate it. Having it open source means we can have valuable community feedback to strengthen the library more effectively and accurately through discussions, collaborations, and competition against anti-anti-vm projects and malware analysis tools which try to hide it's a VM. All of this combined further advances the forefront innovations in the field of VM detections much more productively, compared to having it closed source.
>
> In other words, it's about quality, feedback, and openness over security through obfuscation.

</details>

Expand Down Expand Up @@ -222,9 +234,9 @@ You can view the full docs [here](docs/documentation.md). All the details such a
<summary>Why GPL-3.0 and MIT?</summary>
<br>

> I would've made it strictly MIT so proprietary software can make use of the library, but some of the techniques employed are from GPL 3.0 projects, and I have no choice but to use the same license for legal reasons.
> I would've made it strictly MIT so proprietary software can make use of the library, but some of the techniques employed are from GPL projects, and I have no choice but to use the same license for legal reasons.
>
> This gave me an idea to make an MIT version without all of the GPL code so it can also be used without forcing your code to be open-source. It should be noted that the MIT version removes <b>9</b> techniques out of 126 (as of 2.0 version), and the lesser the number of techniques, the less accurate the overall result might be.
> This gave me an idea to make an MIT version without all of the GPL code so it can also be used without forcing your code to be open source. It should be noted that the MIT version removes <b>9</b> techniques out of 126 (as of 2.0 version), and the lesser the number of techniques, the less accurate the overall result might be.

</details>

Expand Down Expand Up @@ -274,6 +286,7 @@ And if you found this project useful, a star would be appreciated :)
- [ShellCode33](https://github.com/ShellCode33)
- [Georgii Gennadev (D00Movenok)](https://github.com/D00Movenok)
- [utoshu](https://github.com/utoshu)
- [Jyd](https://github.com/jyd519)

<br>

Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
- [ ] implement techniques from here https://www.cyberciti.biz/faq/linux-determine-virtualization-technology-command/
- [ ] implement techniques from virt-what
- [ ] https://cloud.google.com/compute/docs/instances/detect-compute-engine
- [ ] support the odd_thread_count technique for AMD
- [ ] add WMI memo line details in sections category of the banner
- [ ] update the updater.py script and fix it

# Distant plans
- add the library to conan.io when released
Expand Down
4 changes: 2 additions & 2 deletions auxiliary/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def fetch():
header_content.reverse()

# breakpoint
keyword = "// FORMAT: { VM::<ID>, { certainty%, function pointer, is spoofable? } },"
keyword = "// START OF TECHNIQUE TABLE"

# fetch index of breakpoint
index_of_keyword = next((i for i, line in enumerate(header_content) if keyword in line), None)
Expand Down Expand Up @@ -332,7 +332,7 @@ def update_sections(filename):
" * - struct for internal cpu operations => line __CPU__",
" * - struct for internal memoization => line __MEMO__",
" * - struct for internal utility functions => line __UTIL__",
" * - start of internal VM detection techniques => line __TECHNIQUES__",
" * - start of VM detection technique list => line __TECHNIQUES__",
" * - struct for internal core components => line __CORE__",
" * - start of public VM detection functions => line __PUBLIC__",
" * - start of externally defined variables => line __EXTERNAL__"
Expand Down
23 changes: 11 additions & 12 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,9 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::WINE_CHECK` | Check wine_get_unix_file_name file for Wine | Windows | 100% | | GPL | | |
| `VM::HOSTNAME` | Check if hostname is specific | Windows | 10% | | GPL | | |
| `VM::KVM_DIRS` | Check for KVM directory "Virtio-Win" | Windows | 30% | | GPL | | |
| `VM::AUDIO` | Check if audio device is present | Windows | 25% | | GPL | | |
| `VM::QEMU_DIR` | Check for QEMU-specific blacklisted directories | Windows | 30% | | GPL | | |
| `VM::POWER_CAPABILITIES` | Check what power states are enabled | Windows | 25% | | GPL | | |
| `VM::SETUPAPI_DISK` | Checks for virtual machine signatures in disk drive device identifiers | Windows | 20% | | GPL | | |
| `VM::POWER_CAPABILITIES` | Check what power states are enabled | Windows | 50% | | GPL | | |
| `VM::SETUPAPI_DISK` | Checks for virtual machine signatures in disk drive device identifiers | Windows | 100% | | GPL | | |
| `VM::VM_PROCESSES` | Check for any VM processes that are active | Windows | 15% | | | | |
| `VM::LINUX_USER_HOST` | Check for default VM username and hostname for linux | Linux | 10% | | | | |
| `VM::GAMARUE` | Check for Gamarue ransomware technique which compares VM-specific Window product IDs | Windows | 10% | | | | |
Expand All @@ -371,6 +370,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::QEMU_BRAND` | Match for QEMU CPU brands with "QEMU Virtual CPU" string | | 100% | | | | |
| `VM::BOCHS_CPU` | Check for various Bochs-related emulation oversights through CPU checks | | 100% | | | | |
| `VM::BIOS_SERIAL` | Check if the BIOS serial is valid (null = VM) | Windows | 60% | | | | |
| `VM::VBOX_SHARED_FOLDERS` | Check for VirtualBox-specific string for shared folder ID | Windows | 70% | | | | |
| `VM::MSSMBIOS` | Check MSSMBIOS registry for VM-specific strings | Windows | 100% | | | | |
| `VM::MAC_MEMSIZE` | Check if memory is too low for MacOS system | MacOS | 15% | | | | |
| `VM::MAC_IOKIT` | Check MacOS' IO kit registry for VM-specific strings | MacOS | 100% | | | | |
Expand All @@ -396,9 +396,9 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::SMSW` | Check for SMSW assembly instruction technique | Windows | 30% | | | 32-bit | |
| `VM::MUTEX` | Check for mutex strings of VM brands | Windows | 85% | | | | |
| `VM::ODD_CPU_THREADS` | Check for odd CPU threads, usually a sign of modification through VM setting because 99% of CPUs have even numbers of threads | | 80% | | | | |
| `VM::INTEL_THREAD_MISMATCH` | Check for Intel CPU thread count database if it matches the system's thread count | | 100% | | | | |
| `VM::INTEL_THREAD_MISMATCH` | Check for Intel CPU thread count database if it matches the system's thread count | | 150% | | | | |
| `VM::XEON_THREAD_MISMATCH` | Same as above, but for Xeon Intel CPUs | | 100% | | | | |
| `VM::NETTITUDE_VM_MEMORY` | Check for memory regions to detect VM-specific brands | Windows | 100% | | | | |
| `VM::NETTITUDE_VM_MEMORY` | Check for memory regions to detect VM-specific brands | Windows | 100% | | | | |
| `VM::CPUID_BITSET` | Check for CPUID technique by checking whether all the bits equate to more than 4000 | | 25% | | | | |
| `VM::CUCKOO_DIR` | Check for cuckoo directory using crt and WIN API directory functions | Windows | 30% | | | | |
| `VM::CUCKOO_PIPE` | Check for Cuckoo specific piping mechanism | Windows | 30% | | | | |
Expand All @@ -412,7 +412,7 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::KVM_BITMASK` | Check for KVM CPUID bitmask range for reserved values | | 40% | | | | |
| `VM::KGT_SIGNATURE` | Check for Intel KGT (Trusty branch) hypervisor signature in CPUID | | 80% | | | | |
| `VM::VMWARE_DMI` | Check for VMware DMI strings in BIOS serial number | Windows | 40% | | | | |
| `VM::VMWARE_EVENT_LOGS` | Check for presence of VMware in the Windows Event Logs | Windows | 25% | | | | |
| `VM::VM_EVENT_LOGS` | Check for presence of VMs in the Windows Event Logs | Windows | 50% | | | | |
| `VM::QEMU_VIRTUAL_DMI` | Check for presence of QEMU in the /sys/devices/virtual/dmi/id directory | Linux | 40% | | | | |
| `VM::QEMU_USB` | Check for presence of QEMU in the /sys/kernel/debug/usb/devices directory | Linux | 20% | | | | |
| `VM::HYPERVISOR_DIR` | Check for presence of any files in /sys/hypervisor directory | Linux | 20% | | | | |
Expand All @@ -428,7 +428,6 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::WSL_PROC` | Check for WSL or microsoft indications in /proc/ subdirectories | Linux | 30% | | | | |
| `VM::ANYRUN_DRIVER` | Check for any.run driver presence | Windows | 65% | | | | | Removed from the lib, only available in the CLI |
| `VM::ANYRUN_DIRECTORY` | Check for any.run directory and handle the status code | Windows | 35% | | | | | Removed from the lib, only available in the CLI |
| `VM::GPU_CHIPTYPE` | Check for known VM vendors in the GPU chip manufacturer | Windows | 100% | | | | |
| `VM::DRIVER_NAMES` | Check for VM-specific names for drivers | Windows | 100% | | | | |
| `VM::VM_SIDT` | Check for unknown IDT base address | Windows | 100% | | | | |
| `VM::HDD_SERIAL` | Check for HDD serial number | Windows | 100% | | | | |
Expand All @@ -438,19 +437,17 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::GPU_NAME` | Check for VM specific device names in GPUs | Windows | 100% | | | | |
| `VM::VM_DEVICES` | Check for VM-specific devices | Windows | 45% | | | | |
| `VM::VM_MEMORY` | Check for specific VM memory traces in certain processes | Windows | 65% | | | | |
| `VM::IDT_GDT_MISMATCH` | Check if the IDT and GDT limit addresses mismatch between different CPU cores | Windows | 50% | | | | |
| `VM::IDT_GDT_MISMATCH` | Check if the IDT and GDT limit addresses mismatch between different CPU cores | Windows | 50% | Admin | | | |
| `VM::PROCESSOR_NUMBER` | Check for number of processors | Windows | 50% | | | | |
| `VM::NUMBER_OF_CORES` | Check for number of cores | Windows | 50% | | | | |
| `VM::WMI_MODEL` | Check for device's model using WMI | Windows | 100% | | | | |
| `VM::WMI_MANUFACTURER` | Check for device's manufacturer using WMI | Windows | 100% | | | | |
| `VM::WMI_TEMPERATURE` | Check for device's temperature | Windows | 25% | | | | |
| `VM::WMI_TEMPERATURE` | Check for device's temperature | Windows | 25% | Admin | | | |
| `VM::PROCESSOR_ID` | Check for empty processor ids using WMI | Windows | 25% | | | | |
| `VM::CPU_FANS` | Check for CPU Fans | Windows | 35% | | | | |
| `VM::VMWARE_HARDENER` | Checks for VMwareHardenerLoader's method of patching firmware detection by setting its signatures with "7" | Windows | 60% | | | | |
| `VM::SYS_QEMU` | Check for existence of "qemu_fw_cfg" directories within /sys/module and /sys/firmware | Linux | 70% | | | | |
| `VM::LSHW_QEMU` | Check for QEMU string instances with lshw command | Linux | 80% | | | | |
| `VM::VIRTUAL_PROCESSORS` | Check if the number of maximum virtual processors matches the maximum number of logical processors | Windows | 50% | | | | |
| `VM::MOTHERBOARD_PRODUCT` | Check if the motherboard product string matches "Virtual Machine" | Windows | 50% | | | | |
| `VM::HYPERV_QUERY` | Check if a call to NtQuerySystemInformation with the 0x9f leaf fills a _SYSTEM_HYPERVISOR_DETAIL_INFORMATION structure | Windows | 100% | | | | |
| `VM::BAD_POOLS` | Check for system pools allocated by hypervisors | Windows | 80% | | | | |
| `VM::AMD_SEV` | Check for AMD-SEV MSR running on the system | Linux and MacOS | 50% | Admin | | | |
Expand All @@ -461,7 +458,9 @@ VMAware provides a convenient way to not only check for VMs, but also have the f
| `VM::FIRMWARE_SCAN` | Check for VM signatures in firmware | Windows | 90% | | | | |
| `VM::NX_BIT` | Check for AMD64/Intel64 architecture without NX support | Windows | 50% | | | | |
| `VM::FILE_ACCESS_HISTORY` | Check if the number of accessed files are too low for a human-managed environment | Linux | 15% | | | | |

| `VM::AUDIO` | Check if audio device is present | Windows | 25% | | | | |
| `VM::UNKNOWN_MANUFACTURER` | Check if the CPU manufacturer is not known | | 50% | | | | |
| `VM::OSXSAVE` | Check if running xgetbv in the XCR0 extended feature register triggers an exception | Windows | 50% | | | | |

<br>

Expand Down
Loading
Loading