Skip to content

Commit 7e650bb

Browse files
authored
Merge pull request #127 from kernelwernel/dev
Dev
2 parents 0cbd33e + 893f1a6 commit 7e650bb

File tree

9 files changed

+2576
-972
lines changed

9 files changed

+2576
-972
lines changed

.github/workflows/build_run_win_32_debug.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\M
88
copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.30.30704\debug_nonredist\x86\Microsoft.VC143.DebugCRT\vcruntime140d.dll" Debug\
99
copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.30.30704\debug_nonredist\x86\Microsoft.VC143.DebugCRT\msvcp140d.dll" Debug\
1010
cd Debug
11-
vmaware.exe
11+
vmaware.exe
12+
vmaware.exe --spoofable

.github/workflows/build_run_win_64_debug.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\M
88
copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.30.30704\debug_nonredist\x86\Microsoft.VC143.DebugCRT\vcruntime140d.dll" Debug\
99
copy "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.30.30704\debug_nonredist\x86\Microsoft.VC143.DebugCRT\msvcp140d.dll" Debug\
1010
cd Debug
11-
vmaware.exe
11+
vmaware.exe
12+
vmaware.exe --spoofable

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ cmake-build-*/
5757
*copy.hpp
5858
personal_todo.md
5959
notes.txt
60-
auxiliary/tests.cpp
60+
auxiliary/tests.cpp
61+
release_notes.md

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The library is:
1616
- Cross-platform (Windows + MacOS + Linux)
1717
- Compatible with x86 and ARM, with backwards compatibility for 32-bit systems
1818
- Features up to 100+ unique VM detection techniques [[list](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#flag-table)]
19-
- Able to detect 40 VM brands including VMware, VirtualBox, QEMU, Hyper-V, Parallels, and [much more](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#vmbrand)
19+
- Able to detect 40+ VM brands including VMware, VirtualBox, QEMU, Hyper-V, Parallels, and [much more](https://github.com/kernelwernel/VMAware/blob/main/docs/documentation.md#vmbrand)
2020
- Very flexible, with total fine-grained control over which techniques get executed
2121
- Able to detect various semi-VM technologies like hypervisors, emulators, containers, and Wine
2222
- Able to guess the VM brand
@@ -137,13 +137,6 @@ And if you found this project useful, a star would be appreciated :)
137137

138138
<br>
139139

140-
## Projects using VMAware
141-
**[CrashLoggerSSE](https://github.com/alandtse/CrashLoggerSSE)** - SKSE/SKSEVR plugin that generates crash logs
142-
143-
If you know a project, or if you're working on a project that uses VMAware, let me know and I'll add it here.
144-
145-
<br>
146-
147140
## Credits and contributors ✒️
148141
- [Check Point Research](https://research.checkpoint.com/)
149142
- [Unprotect Project](https://unprotect.it/)
@@ -170,6 +163,7 @@ If you know a project, or if you're working on a project that uses VMAware, let
170163
- mrjaxser
171164
- [iMonket](https://github.com/PrimeMonket)
172165
- Eric Parker's discord community
166+
- [ShellCode33](https://github.com/ShellCode33)
173167

174168
<br>
175169

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- [ ] make the whole cache table into a mutex so i can claim it's thread-safe
4343
- [ ] make a medium post about it
4444
- [ ] test the VM::modify_score() function
45+
- [ ] check if bios date in /sys/class/dmi/id/ could be useful under QEMU
4546

4647
# Distant plans
4748
- add the library to conan.io when released

docs/documentation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ This will essentially return the VM brand as a `std::string`. The exact possible
201201
- `Xbox NanoVisor (Hyper-V)`
202202
- `SimpleVisor`
203203
- `Hyper-V artifact (not an actual VM)`
204+
- `User-mode Linux`
205+
- `IBM PowerVM`
206+
- `Google Compute Engine (KVM)`
207+
- `OpenStack (KVM)`
208+
- `KubeVirt (KVM)`
209+
- `AWS Nitro System (KVM-based)`
210+
- `Podman`
211+
- `WSL`
204212

205213
If none were detected, it will return `Unknown`. It's often NOT going to produce a satisfying result due to technical difficulties with accomplishing this, on top of being highly dependent on what mechanisms detected a VM. This is especially true for VMware sub-versions (ESX, GSX, Fusion, etc...) Don't rely on this function for critical operations as if it's your golden bullet. It's arguably unreliable and it'll most likely return `Unknown` (assuming it is actually running under a VM).
206214

src/cli.cpp

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#include "vmaware.hpp"
4545

46-
constexpr const char* ver = "1.7.1";
46+
constexpr const char* ver = "1.8";
4747
constexpr const char* date = "August 2024";
4848

4949
constexpr const char* bold = "\033[1m";
@@ -245,6 +245,15 @@ Microsoft Azure Hyper-V
245245
Xbox NanoVisor (Hyper-V)
246246
SimpleVisor
247247
Hyper-V artifact (not an actual VM)
248+
User-mode Linux
249+
IBM PowerVM
250+
Google Compute Engine (KVM)
251+
OpenStack (KVM)
252+
KubeVirt (KVM)
253+
AWS Nitro System (KVM-based)
254+
Podman
255+
WSL
256+
OpenVZ
248257
)";
249258

250259
std::exit(0);
@@ -272,6 +281,11 @@ std::string type(const std::string &brand_str) {
272281
{ "Intel HAXM", "Hypervisor (type 1)" },
273282
{ "Intel KGT (Trusty)", "Hypervisor (type 1)" },
274283
{ "SimpleVisor", "Hypervisor (type 1)" },
284+
{ "Google Compute Engine (KVM)", "Hypervisor (type 1)" },
285+
{ "OpenStack (KVM)", "Hypervisor (type 1)" },
286+
{ "KubeVirt (KVM)", "Hypervisor (type 1)" },
287+
{ "IBM PowerVM", "Hypervisor (type 1)" },
288+
{ "AWS Nitro System EC2 (KVM-based)", "Hypervisor (type 1)" },
275289

276290
// type 2
277291
{ "VirtualBox", "Hypervisor (type 2)" },
@@ -285,6 +299,7 @@ std::string type(const std::string &brand_str) {
285299
{ "Virtual Apple", "Hypervisor (type 2)" },
286300
{ "NetBSD NVMM", "Hypervisor (type 2)" },
287301
{ "OpenBSD VMM", "Hypervisor (type 2)" },
302+
{ "User-mode Linux", "Hypervisor (type 2)" },
288303

289304
// sandbox
290305
{ "Cuckoo", "Sandbox" },
@@ -304,11 +319,15 @@ std::string type(const std::string &brand_str) {
304319
{ "Jailhouse", "Partitioning Hypervisor" },
305320
{ "Unisys s-Par", "Partitioning Hypervisor" },
306321
{ "Docker", "Container" },
322+
{ "Podman", "Container" },
323+
{ "OpenVZ", "Container" },
307324
{ "Microsoft Virtual PC/Hyper-V", "Hypervisor (either type 1 or 2)" },
308325
{ "Lockheed Martin LMHS", "Hypervisor (unknown type)" },
309326
{ "Wine", "Compatibility layer" },
310327
{ "Apple VZ", "Unknown" },
311-
{ "Hyper-V artifact (not an actual VM)", "No VM" }
328+
{ "Hyper-V artifact (not an actual VM)", "No VM" },
329+
{ "User-mode Linux", "Paravirtualised" },
330+
{ "WSL", "Hybrid Hyper-V (type 1 and 2)" }, // debatable tbh
312331
};
313332

314333
auto it = type_table.find(brand_str);
@@ -359,7 +378,11 @@ bool is_spoofable(const VM::enum_flags flag) {
359378
case VM::CUCKOO_PIPE:
360379
case VM::HYPERV_HOSTNAME:
361380
case VM::GENERAL_HOSTNAME:
362-
case VM::BLUESTACKS_FOLDERS: return true;
381+
case VM::BLUESTACKS_FOLDERS:
382+
case VM::EVENT_LOGS:
383+
case VM::KMSG:
384+
case VM::VM_PROCS:
385+
case VM::PODMAN_FILE: return true;
363386
default: return false;
364387
}
365388
}
@@ -384,15 +407,20 @@ bool are_perms_required(const VM::enum_flags flag) {
384407
if (is_admin()) {
385408
return false;
386409
}
387-
#endif
388410

389411
switch (flag) {
390412
case VM::VBOX_DEFAULT:
391413
case VM::VMWARE_DMESG:
392414
case VM::DMIDECODE:
393-
case VM::DMESG: return true;
415+
case VM::DMESG:
416+
case VM::QEMU_USB:
417+
case VM::KMSG:
418+
case VM::SMBIOS_VM_BIT: return true;
394419
default: return false;
395420
}
421+
#else
422+
return false;
423+
#endif
396424
}
397425

398426
void general() {
@@ -548,6 +576,19 @@ void general() {
548576
checker(VM::KGT_SIGNATURE, "Intel KGT signature");
549577
checker(VM::VMWARE_DMI, "VMware DMI");
550578
checker(VM::EVENT_LOGS, "Hyper-V event logs");
579+
checker(VM::QEMU_VIRTUAL_DMI, "QEMU virtual DMI directory");
580+
checker(VM::QEMU_USB, "QEMU USB");
581+
checker(VM::HYPERVISOR_DIR, "Hypervisor directory (Linux)");
582+
checker(VM::UML_CPU, "User-mode Linux CPU");
583+
checker(VM::KMSG, "/dev/kmsg hypervisor message");
584+
checker(VM::VM_PROCS, "various VM files in /proc");
585+
checker(VM::VBOX_MODULE, "VBox kernel module");
586+
checker(VM::SYSINFO_PROC, "/proc/sysinfo");
587+
checker(VM::DEVICE_TREE, "/proc/device-tree");
588+
checker(VM::DMI_SCAN, "DMI scan");
589+
checker(VM::SMBIOS_VM_BIT, "SMBIOS VM bit");
590+
checker(VM::PODMAN_FILE, "Podman file");
591+
checker(VM::WSL_PROC, "WSL string in /proc");
551592

552593
std::printf("\n");
553594

@@ -577,7 +618,7 @@ void general() {
577618
}
578619

579620
const char* percent_color = "";
580-
const std::uint8_t percent = VM::percentage(VM::NULL_ARG/*spoofable_setting*/);
621+
const std::uint8_t percent = VM::percentage(spoofable_setting);
581622

582623
if (percent == 0) { percent_color = red; }
583624
else if (percent < 25) { percent_color = red_orange; }

0 commit comments

Comments
 (0)