#vm #detect #timing

inside-vm

detect virtual machine using timing

2 unstable releases

0.2.0 Jul 11, 2021
0.1.0 Jul 9, 2021

#204 in Emulators

Download history 16/week @ 2024-07-28 100/week @ 2024-08-04 12/week @ 2024-08-11 10/week @ 2024-08-18 1/week @ 2024-08-25 23/week @ 2024-09-01 15/week @ 2024-09-08 1/week @ 2024-09-15 16/week @ 2024-09-22 9/week @ 2024-09-29 13/week @ 2024-10-06 5/week @ 2024-10-13 8/week @ 2024-10-20 3/week @ 2024-10-27 69/week @ 2024-11-03 14/week @ 2024-11-10

94 downloads per month
Used in rsmount

MIT/Apache

7KB

rtw crate rtw documentation

inside-vm

Detect if code is running inside a virtual machine.

Only works on x86 and x86-64.

How does it work

Measure average cpu cycles when calling cpuid and compare to a threshold, if the value is high assume code is running inside a VM.

Quick Start

git clone https://github.com/PicoJr/inside-vm
cd inside-vm/
cargo run --example test-inside-vm

output: avg cycles for __cpuid: 108

vs inside VM

[vagrant@archlinux vagrant]$ ./target/release/examples/test-inside-vm 

output: avg cycles for __cpuid: 30578

API

use inside_vm::inside_vm;

let inside = inside_vm();
println!("inside vm: {}", inside);

Credits

https://evasions.checkpoint.com/techniques/timing.html#difference-vm-hosts

Changelog

Please see the CHANGELOG for a release history.

License

Dual-licensed under MIT or the Apache License V2.0.

No runtime deps