inside-vm 0.2.0

detect virtual machine using timing
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented4 out of 4 items with examples
  • Size
  • Source code size: 18.02 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 696.05 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • PicoJr/inside-vm
    45 3 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • PicoJr

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.