MIT License

项目介绍

NotRequiem/VMAware 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,采用 MIT License 许可证,目前获得 1.5k 个 Star、145 次 Fork。

仓库全名
NotRequiem/VMAware
开源许可证
MIT License
Star 数
1.5k
Fork 数
145

README 摘要

VMAware (VM + Aware) is a cross-platform C++ framework for virtual machine detection. 中文 🇨🇳 | Français 🇫🇷 | 한국어 🇰🇷 | Русский 🇷🇺 The library is: Very easy to use Cross-platform (Windows + MacOS + Linux) Multi-architecture compatible (alpha, amd64, arm64, arm64ec, armel, armhf, hppa, i386, m68k, mips, mipsel, mips64, mips64el, powerpc, ppc64, ppc64el, riscv64, s390x, sh4, sparc64, x32) Equipped with around 90…

完整内容见 GitHub 原始 README 或本页 。

常见问题

VMAware 用什么语言开发?

主要使用 C++ 编写,采用 MIT License 许可证,目前有 1.5k 个 Star。

VMAware 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 VMAware 的源码?

可以直接克隆仓库:git clone https://github.com/NotRequiem/VMAware.git,默认分支为 main;安装与运行步骤见仓库 README。

VMAware 最近还在维护吗?

仓库最近一次更新为 6 天前,当前没有未关闭的 Issue;Star 数为 1.5k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Advanced VM detection library and tool

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

C++
CMake
PowerShell
Python
Ruby
Shell

Release

README




VMAware (VM + Aware) is a cross-platform C++ framework for virtual machine detection.

中文 🇨🇳 | Français 🇫🇷 | 한국어 🇰🇷 | Русский 🇷🇺

The library is:

  • Very easy to use
  • Cross-platform (Windows + MacOS + Linux)
  • Multi-architecture compatible (alpha, amd64, arm64, arm64ec, armel, armhf, hppa, i386, m68k, mips, mipsel, mips64, mips64el, powerpc, ppc64, ppc64el, riscv64, s390x, sh4, sparc64, x32)
  • Equipped with around 90 unique VM detection techniques [list]
  • Built with the most cutting-edge techniques
  • Capable of detecting around 70 VM brands, including VMware, VirtualBox, QEMU, Hyper-V, and many more [list]
  • Able to beat VM hardeners
  • Very flexible, with fine-grained control over which techniques get executed
  • Capable of detecting various VM and semi-VM technologies, including hypervisors, emulators, containers, sandboxes, and more
  • Memoized, meaning past results are cached and retrieved if ran again for performance benefits
  • Available with C++11 and above
  • Backed by an ecosystem of ports to other languages such as Rust, JavaScript, and Ruby
  • Header-only
  • Free of any external dependencies
  • Fully MIT-licensed, allowing unrestricted use and distribution

Example 🧪

#include "vmaware.hpp"
#include <iostream>

int main() {
    if (VM::detect()) {
        std::cout << "Virtual machine detected!" << "\n";
    } else {
        std::cout << "Running on bare metal" << "\n";
    }

    std::cout << "VM name: " << VM::brand() << "\n";
    std::cout << "VM type: " << VM::type() << "\n";
    std::cout << "VM certainty: " << (int)VM::percentage() << "%" << "\n";
}

Possible output:

Virtual machine detected!
VM name: VirtualBox
VM type: Hypervisor (type 2)
VM certainty: 100%

Structure ⚙️



CLI tool 🔧

This project also provides a handy CLI tool utilising the full potential of what the library can do. It also has cross-platform support.

Below is an example of a basic QEMU system with no hardening modifications on Linux.


Installation 📥

To install the library, download the vmaware.hpp file in the latest release section to your project. The binaries are also located there. No CMake or shared object linkages are necessary, it’s literally that simple.

However, if you want the full project (globally accessible headers with <vmaware.hpp> and the CLI tool), follow these commands:

git clone https://github.com/NotRequiem/VMAware 
cd VMAware

FOR LINUX:

sudo dnf/apt/yum update -y # change this to whatever your distro is
mkdir build
cd build
cmake ..
sudo make install

FOR MACOS:

mkdir build
cd build
cmake ..
sudo make install

FOR WINDOWS:

cmake -S . -B build/ -G "Visual Studio 16 2019"

Optionally, you can create a debug build by appending -DCMAKE_BUILD_TYPE=Debug to the cmake arguments.


CMake installation

# edit this
set(DIRECTORY "/path/to/your/directory/")

set(DESTINATION "${DIRECTORY}vmaware.hpp")

if (NOT EXISTS ${DESTINATION})
    message(STATUS "Downloading VMAware")
    set(URL "https://github.com/NotRequiem/VMAware/releases/latest/download/vmaware.hpp")
    file(DOWNLOAD ${URL} ${DESTINATION} SHOW_PROGRESS)
else()
    message(STATUS "VMAware already downloaded, skipping")
endif()

The module file and function version is located here


Documentation and code overview 📒

You can view the full docs here.

All the details such as functions, techniques, settings, and examples are provided. Trust me, it’s not too intimidating ;)


Ports to other languages 🔀

VMAware also has support for a variety of languages, if C++ isn’t the language you’re looking for then please refer to this list below. All of these projects are officially referred to by the VMAware developers.

Language Repository Details Author
Ruby link Official Ruby port embedded in the VMAware repository. Windows is not supported. Adam Ruman
JS link Same API as VMAware. Support for 64-bit only. Actively maintained. Kyun-J
Rust link Binding. Same API as VMAware. Actively maintained Marcel
Warning 警告

Although unofficial ports exists, they are not tested compared to our official ones. Use them at your own risk.


Q&A ❓

How does it work?

It utilises a comprehensive list of low-level and high-level anti-VM techniques that gets accounted in a scoring system. The scores (0-100) for each technique are given based on an objective criteria focused on detecting the most stealthy VMs by minimizing false positives as much as possible, and every technique that has detected a VM will have their score added to a single accumulative point, where a threshold point number will decide whether it’s actually running in a VM.

Who is this library for and what are the use cases?

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. The library is useful for malware analysts testing the concealment of their VMs and for proprietary software developers aiming to protect their applications from reverse engineering. It’s an effective tool to benchmark how well a VM can hide itself from detection.

Additionally, software could adjust the behaviour of their program based on the detected environment. It could be useful for debugging purposes, while system administrators could manage configurations differently. Finally, some applications might want to legally restrict usage in VMs as a license clause to prevent unauthorized distribution or testing.

Why another VM detection project?

There’s already loads of projects that have the same goal such as InviZzzible, pafish and Al-Khaser. 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. Additionally, the VM detections in all those projects are often not sophisticated enough to be practically applied to real-world scenarios. An additional hurdle is that they are all GPL projects, so using them for proprietary projects (which would be the main audience for such a functionality), is out of the question. Pafish and InviZzzible have been abandoned for years.

While those projects have been useful to VMAware to some extent, we wanted to make them far better. Our goal was to make the detection techniques to be accessible programmatically in a cross-platform and flexible way for everybody to get something useful out of it rather than providing just a CLI tool. In summary, this is a VM detection framework that focuses on practical and realistic usability for any scenario, aiming to provide the most accurate result of the environment where your software is running under.

Wouldn't it make it inferior for having the project open source?

VMAware is fully open source, which makes the job of bypassers easier compared to having it closed source. However, We’d argue that’s a worthy tradeoff by having as many VM detection techniques in an open and interactive manner. It 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 their presence.

All of this combined has further advanced the forefront innovations in the field of VM detections much more productively, compared to having it closed source. In other words, it’s about better quality AND quantity, better feedback, and better openness over security through obfuscation. It’s the same reason why OpenSSH, OpenSSL, the Linux kernel, and other security-based software projects are relatively secure because of how there’s more people helping to make it better compared to people trying to probe the source code with malicious intent. VMAware has this philosophy, and if you know anything about security, you should be familiar with the phrase: “Security through obfuscation is NOT security”.

How effective are VM hardeners against the lib?

Publicly known hardeners are not effective and most of them on Windows have been beaten, but this doesn’t mean that the lib is immune to them. Custom hardeners that we may not be aware of might have a theoretical advantage, but they are substantially more difficult to produce.

We continously track both open and closed source projects and bypasses to detect them. Windows is the most targeted operating system for bypassing VM detections, so our main focus is to strengthen detections for this platform.

Currently, no public repository, project or code base in general is able to fully bypass on Windows. When a working public bypass is found, it usually gets fixed in a couple of days. Our arms race is mostly battled against private methods gatekept by cheaters to bypass both VMAware and anti-cheats.

How is it developed?

By researching, we identify the methods currently used to hide VMs and investigate generic detection techniques capable of detecting those methods.

Once we have production-ready code, we upload it to this repository and begin experimental testing in real environments. All code in any github branch is experimental, while the latest release represent our stable code.

Some products that use our project run our library on thousands of systems, collaborating with us to report back how VMAware behaved in such systems. All those reports are manually checked by us for false positives or any other problem in general.

While techniques are evaluated, scores for those techniques are dynamically adjusted based on their effectiveness, reliability, and how they operate together with other detection techniques. The criteria used to put our scores can be found here.

Using GitHub Actions, we automatically monitor if both compilation and runtime problems occur in every platform we target, each time a new commit is uploaded to our repository.

When the library has accumulated enough changes under our view, we publish a release and explain those changes in detail. Before releasing, we do a security audit to ensure the new published version is safe.

What about using this for malware?

This project is not soliciting the development of malware for obvious reasons. Even if you intend to use it for concealment purposes, it’ll most likely be flagged by antiviruses anyways and nothing is obfuscated to begin with.

We do not intentionally develop the library to try to stop or avoid EDR flags, such as using direct/indirect syscalling, inline hooking detection, and any other kind of malware evasion technique not related to virtualization detection.

Is a kernel-mode component planned to be developed?

No. In our opinion, there are no good user-mode solutions for VM detection, and we want to devote all our time to meeting this demand. We can still detect most stealthy virtualised environments while being completely user-mode.

Is it thread-safe?

No. Do not call functions of this library with multiple threads simultaneously, we don’t take more than 1s to run.

I have linker errors when compiling

If you’re compiling with gcc or clang, add the -lm and -lstdc++ flags, or use g++/clang++ compilers instead. If you’re receiving linker errors from a brand new VM environment on Linux, update your system with sudo apt/dnf/yum update -y to install the necessary C++ components.


Issues, discussions, pull requests, and inquiries 📬

If you have any suggestions, ideas, or any sort of contribution, feel free to ask! I’ll be more than happy to discuss either in the issue or discussion sections. If you want to personally ask something in private, contact shenzken on Discord.

For email inquiries: [email protected]


Credits, contributors, and acknowledgements ✒️



You are solely responsible for how you use this repository and for ensuring your use complies with applicable law, regulations, and the terms of any third-party systems, services, accounts, or data you interact with.

No endorsement is implied by publication of this repository or by any reference to third-party products, services, names, or trademarks.

Third-party software, models, datasets, binaries, and other materials included in or referenced by this repository remain subject to their own licenses and terms. You are responsible for reviewing and complying with those separate terms.

License: MIT

评论

暂无评论