Skip to content

Fix Hyper-V guest detection for DPAPI fallback on bastions/VDI#154

Merged
jgowdy-godaddy merged 2 commits into
mainfrom
fix/hyper-v-vm-detection
May 20, 2026
Merged

Fix Hyper-V guest detection for DPAPI fallback on bastions/VDI#154
jgowdy-godaddy merged 2 commits into
mainfrom
fix/hyper-v-vm-detection

Conversation

@jgowdy-godaddy
Copy link
Copy Markdown
Contributor

Summary

  • Hyper-V guests (Azure VMs, on-prem bastions, VDI) fail to use the DPAPI fallback when TPM is unavailable because they report Microsoft Hv as the CPUID hypervisor vendor, which is explicitly excluded to protect physical Windows VBS machines from silently downgrading
  • The fix: when CPUID reports Microsoft Hv, additionally check the registry manufacturer. Physical machines with VBS show their real OEM (Dell Inc., LENOVO, HP, etc.); Hyper-V guests show Microsoft Corporation. Allow the DPAPI fallback in the latter case.
  • Surface devices are Microsoft hardware but have working TPMs and never reach this fallback path.

Test plan

  • CI passes
  • hyper_v_guest_detected_via_microsoft_corporation_manufacturer test covers the new logic
  • vbs_on_physical_oem_hardware_not_treated_as_vm confirms physical OEM machines are unaffected
  • vm_string_classifier_does_not_treat_vbs_hypervisor_vendor_as_vm still passes

jgowdy added 2 commits May 20, 2026 14:24
The VM detection excludes "Microsoft Hv" as a CPUID vendor to avoid
false positives on physical hardware running Windows VBS. However,
Hyper-V guests (Azure VMs, on-prem bastions, VDI) also report
"Microsoft Hv" and need the DPAPI fallback when TPM is unavailable.

Distinguish them by registry manufacturer: physical machines with VBS
show their real OEM (Dell, Lenovo, HP, etc.), while Hyper-V guests show
"Microsoft Corporation". When CPUID reports "Microsoft Hv" and the
already-computed registry string contains "Microsoft Corporation",
treat the machine as a VM and allow the DPAPI fallback.

Note: Surface devices are Microsoft hardware but have working TPMs, so
they never reach this fallback path.
@jgowdy-godaddy jgowdy-godaddy force-pushed the fix/hyper-v-vm-detection branch from 9c43665 to f462c76 Compare May 20, 2026 21:26
@jgowdy-godaddy jgowdy-godaddy merged commit 088dc8d into main May 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants