Why did I dive into this?
Trouble with virtual machines
Measures to detect presence of virtual machine
Hacking the linux kernel as countermeasure
Compiling QEMU and custom UEFI
Conclusion
Bypass anti-cheat of online games
Hide virtual machine to guest
Learning
How far will I get? (achievement)
Privacy?
BUT WHY?
Kernel driver (ring 0)
Usermode service
Multiple cheat detection mechanisms
Virtual machine detection
phsyical hardware = €€€
virtual hardware = free
use a virtual machine!
but what about the GPU?
other people have done it before
pass host gpu to guest
linux kernel modifications
For amusement, watch
https://youtu.be/L1JCCdo1bG4
(for gaming)
libvirt
api/daemon/cli
qemu
software virtualization, standalone (slow stuff)
kvm
kernel virtual machine (fast stuff)
vm exit = transition from execution to emulation!
new hardware identifiers for the anti-cheat
leverage gaming graphics card in virtual machine
time travel through snapshots of vm
save ram to disk (fast stuff!)
generic hardware = hint for vm presence
guest occupies graphics card... and the host?
not very reliable setup
crashes, freezes, stuck in boot loop
heavy resource consumption
(not me, I borrowed a screen from the office!)
Obviously a virtual machine
Not so obvious
tools to automatically check presence of vm
Thanks to a reddit post for inspiration
hardware | intercepted | |
---|---|---|
cpuid | 30-100 ops | 800+ ops |
... | ~ x 10 |
vmexit
vmenter
intercept the cpu instruction
normal execution
kernel interception
cpuid
...
static int handle_rdtsc_interception(struct vcpu_svm *svm)
{
u64 differece;
u64 final_time;
u64 data;
differece = rdtsc() - svm->vcpu.last_exit_start;
final_time = svm->vcpu.total_exit_time + differece;
data = rdtsc() - final_time;
svm->vcpu.arch.regs[VCPU_REGS_RAX] = data & -1u;
svm->vcpu.arch.regs[VCPU_REGS_RDX] = (data >> 32) & -1u;
svm->vcpu.run->exit_reason = 123;
return nop_interception(svm);
}
// offset time!!!
only for this to turn green!