MOKSHA-2026-0087: QEMU Device Model Selection via VM.platform device-model (Limited by Whitelist)

Advisory IDMOKSHA-2026-0087
Semantic IDPLAT-3
Published2026-04-24
CVSS 3.12.3 Low
CVSS 3.1 VectorAV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
CVSS 4.05.3 Medium
CVSS 4.0 VectorAV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
XAPI ObjectVM
XAPI Fieldplatform:device-model
Entry Rolevm-admin
ResearcherJakob Wolffhechel, Moksha

Affected Products

VendorProductVersions
Citrix / Cloud Software GroupXenServer / Citrix Hypervisorall versions (shared XAPI codebase)
VatesXCP-ng8.3.0

Summary

A vm-admin in XAPI-based hypervisors (XenServer, XCP-ng) can set VM.platform:device-model to influence QEMU device model selection. A double whitelist limits the impact: XAPI's sanity_check at vm_platform.ml:38 validates the value against known profile names (qemu-upstream-compat, qemu-upstream-uefi, qemu-upstream), and xenopsd's Profile.of_string at xenops_server_xen.ml:70-71 resolves the profile to a hardcoded binary path. Unknown values silently default to Qemu_upstream_compat. The attacker cannot force qemu-trad (legacy QEMU) or an arbitrary binary path. The impact is limited to selecting between three supported QEMU profiles, which differ in device emulation compatibility but not in security posture. The VM.platform field has zero map_keys_roles entries.

Vulnerability Description

VM.platform is a Map(String, String) field defined at datamodel_vm.ml:2717-2720 with zero map_keys_roles entries.

The device-model key passes through two validation layers:

Layer 1 - XAPI sanity_check (vm_platform.ml:38): The sanity_check function runs at VM start time and checks the device-model value against a list of recognized profiles. Unrecognized values are logged but not rejected - the default profile is used instead.

Layer 2 - xenopsd Profile.of_string (xenops_server_xen.ml:70-71):

Profile.of_string resolves the profile name:
    "qemu-upstream-compat" -> Qemu_upstream_compat
    "qemu-upstream-uefi"   -> Qemu_upstream_uefi
    "qemu-upstream"        -> Qemu_upstream
    _                      -> Qemu_upstream_compat (default)

The QEMU binary path is hardcoded based on the profile. There is no path from the device-model key to an arbitrary binary execution.

The three supported profiles differ in PCI device emulation behavior (IDE vs AHCI, i440FX vs Q35 chipset) but share the same QEMU binary and security features. Switching between them changes guest device compatibility, not security posture.

Root Causes

  1. Missing RBAC protection. VM.platform has zero map_keys_roles entries in datamodel_vm.ml. The device-model key is writable by vm-admin.

  2. Write-time vs. start-time validation gap. XAPI accepts any device-model value at write time. Validation occurs only at VM start, where unrecognized values silently default to the compatible profile.

  3. set_platform RBAC bypass. The set_platform method replaces the entire map and bypasses map_keys_roles per-key checks.

Affected Systems

Directly Affected

Indirectly Affected

Exploitation Scenarios

Scenario Impact Pre-conditions Status
Profile switch Guest sees different PCI device topology, possible driver issues vm-admin, HVM VM Source-traced
Invalid value injection Silent fallback to Qemu_upstream_compat, no operational impact vm-admin Source-traced
BOC-1 chain vm-admin changes device model across all VMs via RBAC collapse vm-admin, BOC-1 Source-traced

Chaining Analysis

Detection

Remediation

Short-Term Mitigations

Long-Term Fix

Add write-time validation. Reject device-model values not in the recognized set at write time, not just at start time.

Add map_keys_roles protection. Restrict the device-model key to _R_POOL_ADMIN in datamodel_vm.ml. QEMU variant selection is an infrastructure-level decision.

Replace with typed field. The device-model key has exactly three valid values. It should be an enumeration field.

Upstream patches exist. They are held privately pending coordinated disclosure.

Disclosure

Disclosure:

References

Credits

Discovered and reported by Jakob Wolffhechel, Moksha.

Jakob Wolffhechel · Moksha · Copenhagen
jakob@wolffhechel.dk · +45 3170 7337
Published 2026-04-24 08:00 CEST · cna.moksha.dk · shittrix.moksha.dk