Fix for Timing: remove outdated CPUID timing check on modern Windows 26H1 due to VBS and Hyper-V - #302
Conversation
…indows 26H1 due to VBS and Hyper-V
|
no need at all just check if you're running on top of a Hyper-V layer (type 1) or a Hyper-V VM (type 2), and if you're running under type 1, attempt to detect nested virtualization using a higher latency threshold. When KVM runs on top of Hyper-V for example you will hit 8k+ cycles or even more (not in all cases), being in a root partition alone (Hyper-V) will flag around 1k to 2.5k cycles without taking into account kernel noise, but you can reliably detect or discard from cpl3 when theres jitter/spikes due to an interrupt/dpc or something else, otherwise just flag the Hyper-V VM |
|
also no offense but this seems like blatant ai sloop |
|
|
I've fully read the papers you had, and now I strongly believe you don't get the full picture of the idea at all, you don't need to give up on "Hyper-V + VBS"
I didn't even mention a single check that is being taken into account during calculations, all kernel noise discards are made after collecting information, I strongly discourage trying to make syscalls to compute interrupt information while you actively collect samples I don't know where this project mentions that the only goal is to detect sandboxes, that routine covers VM detection as well, and timing attacks are the first thing one looks for when detecting hypervisors and/or VMs, I don't think the idea of this project is to actually have absolutely zero false flags but to give a detailed amount of information that can be lated manually reviewed, given the amount of false flags this project does not cover in real world scenarios, VM detections is just a side topic/feature on this project like with sandboxes. You don't need a lot of computations (althought that word is extremely subjective) to expose vmexit latency while also ignoring the kernel noise itself, and I can provide evidence of more than 200000 machines running the same test and not having false flags. For reference, I've computed the following tests in this manner (in the case of Windows):
Now perform a simple mathematical algorithm I've developed during my experimental phases based on clustering and make it the function code you will use to discard noise (if any), if you followed the previous steps you will unlikely have the 50% of your samples "poisoned" or "dirty": Even if this seems a lot, it does run in less than a second. You could even improve the algorithm above with a Gaussian + heavy-tailed/uniform with EM and take the smaller-mean component as "clean", because the only downside (which doesn't affect anything in practical scenarios) is that if the "clean" latency is not the leftmost mode, you could end up choosing the lower cluster incorrectly, but that's the point of doing a lot of setup before running anything. Now to provide experimental evidence and to ensure i'm completely neutral and not just showing the "good part", I've choosen a few thousands (around 10k+ CPUs, from every type of SKU and vendor, manufactured this year or even 20-30 years ago) that include proofs of false flags in the timing checks attached to this message, that were fixed during these years of testing and testing: Not to mention that even if for some strange reason you get a FP, you will not take it immediately as a red flag, it's just an indicator/sign of hypervisor exposure, the detection should still collect more samples, but it doesn't justificate the complete removal of the routine being one of the most helpful indicators (and hardest) to patch. Nevertheless, you can get reliable detections from UM of running in a sandbox/hypervisor which tries to hide itself from timing detections, and that would immediately mean you're not under some kind of "exotic enterprise environment" like the ones you mention, which of course goes out of the scope for this message |
|
|
again, the point is that the detection you're trying to remove is not primarily focused towards sandbox env detection, and the argument of "the technique is unreliable because Windows can run on Hyper-V" is wrong, the code (if anything) needs to be improved, not completely removed, because it provides valuable information of the environment even disabling the technique in certain circumstances would be more beneficial, such as only running the rdtsc check if you detect that you're NOT running in the root partition, which is just a single cpuid call on the hypervisor leaf (ebx on 0x40000003) |
…dows due to VBS and Hyper-V, that are enabled by default
|
Remove outdated CPUID timing check on modern Windows rdtsc_diff_vmexit due to false positive.
Note: Two new detection techniques will be added in the next pull requests, so this removal will be compensated by fresh, more reliable checks.
26H1-results-al-khaser_x64.txt
26H1-Get-ComputerInfo.txt
26H1-systeminfo.txt