MOKSHA-2026-0002: Storage Protocol Injection via sm_config

Advisory IDMOKSHA-2026-0002
Semantic IDSMC-1
Published2026-04-24
CVSS 3.19.9 Critical
CVSS 3.1 VectorAV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
CVSS 4.08.6 High
CVSS 4.0 VectorAV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:H/VA:H/SC:H/SI:H/SA:H
XAPI ObjectVDI, SR
XAPI Fieldsm_config
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 user with the vm-admin role can write arbitrary key-value pairs to VDI.sm_config and SR.sm_config via the XAPI management API. These fields store internal storage driver state - VHD chain metadata, GC control flags, encryption key hashes, and SR provisioning parameters. XAPI performs zero validation on written values and never notifies the storage backend of changes. The SM driver discovers the corruption only when it next reads sm_config during a routine operation and acts on the attacker's data as authoritative internal state. The hypervisor becomes a silent proxy, forwarding corrupted metadata to the storage subsystem through the trusted management channel. The resulting storage operations are indistinguishable from legitimate activity.

Vulnerability Description

VDI.sm_config and SR.sm_config are Map(String, String) fields in the XAPI data model. SM (Storage Manager) drivers store their internal operational state in these fields: VHD parent-child chain metadata (vhd-parent), VDI type information (vdi_type), garbage collector control flags (paused, activating, relinking, vhd-blocks), encryption key hashes (key_hash), and SR provisioning parameters (allocation).

The write path is a pure database operation:

  1. vm-admin calls VDI.add_to_sm_config(vdi, "vhd-parent", "<attacker-controlled-uuid>")
  2. XAPI stores the value in the database with zero validation
  3. XAPI does not notify the SM driver of the change
  4. On the next SR scan, GC pass, or VDI operation, the SM driver reads the corrupted value
  5. The driver operates on the attacker's data as if it were authoritative

The attack is entirely silent. No audit log, no XAPI event, no storage-side indicator. The write is a database operation that the system treats as routine configuration.

Code Paths

Root Causes

  1. Zero write-time validation. VDI.add_to_sm_config() and VDI.set_sm_config() perform pure database writes. No value is checked, no backend is consulted, no event is emitted.

  2. RBAC gap. vm-admin has full write access to VDI.sm_config. The MRO guard in the xe CLI produces a warning but does not block the write. XenAPI clients (Xen Orchestra, CloudStack, custom scripts) bypass xe entirely.

  3. Backend blind trust. SM drivers read sm_config values and use them directly in storage operations without independent validation against on-disk state. The auto-heal mechanism (_override_sm_config) only runs during SR scan - not on every read.

  4. Protected-key persistence. Keys in smconfig_protected_keys (paused, activating, relinking, vhd-blocks) are never auto-healed. Once injected, they persist until manually removed.

Affected Systems

Directly Affected

Storage Backends Affected

Driver SR Types Critical Keys Impact
LVHDSR lvmoiscsi, lvmohba, lvmofcoe, lvm vdi_type, vhd-parent, paused, host_* KeyError crash (entire SR offline), GC misdirection, chain severance
FileSR ext, nfs, cephfs, glusterfs, smb vhd-parent, key_hash, type Chain severance, encryption lockout, I/O path confusion
LinstorSR linstor vdi_type, host_* KeyError crash, split-brain across DRBD nodes
RawISCSISR rawhba SCSIid, LUNid Cross-VM data access via LUN redirection

Indirectly Affected

Exploitation Scenarios

Seven scenarios are confirmed with live evidence across NFS, iSCSI, and EXT SR types. Each scenario has a dedicated PoC script and committed evidence logs.

Scenario Impact Status
S2: VHD chain severance Break snapshot chains; GC deletes orphaned VHDs. Data loss. ALL PASS (NFS, iSCSI, EXT)
S3: VDI type confusion Wipe vdi_type key; KeyError crash takes entire SR offline for all VMs ALL PASS (iSCSI)
S4: GC misdirection Poison vhd-parent to point at different VDI; GC deletes or coalesces wrong data ALL PASS (NFS, iSCSI, EXT)
S8: SR config corruption Replace SR-level sm_config; driver crashes on next VDI creation. No auto-heal for SR metadata. ALL PASS (iSCSI)
S9: Pause state injection Inject paused=true; GC skips VDI indefinitely. Key persists forever. ALL PASS (NFS, iSCSI)
S10: GC state injection Inject GC-internal keys (activating, relinking); GC enters spin-wait loops, storage saturates ALL PASS (NFS, iSCSI)
S11: Type race window Exploit _determineType() race between sr-scan auto-heal and next read ALL PASS (iSCSI)

Forensic Gap

On iSCSI/LVM-backed SRs, the attack is undetectable after the fact. The vhd-util query tool fails on snapshot-created LVs because the LVs cannot be independently activated. Defenders cannot compare XAPI metadata against on-disk VHD headers, cannot confirm whether vhd-parent values are correct, and cannot assess blast radius after a suspected compromise.

Detection

Remediation

Short-Term Mitigations

Long-Term Fix

Layer 1 - Key Protection: Reject writes to known driver-internal keys (vhd-parent, vdi_type, paused, activating, relinking, vhd-blocks, key_hash, host_*, SCSIid, LUNid, allocation) unless the caller is an SM driver internal session. Implementation location: ocaml/xapi/xapi_vdi.ml.

Layer 2 - RBAC Tightening: Restrict VDI.add_to_sm_config, VDI.set_sm_config, and equivalents to pool-admin or a new storage-admin role.

Layer 3 - Driver-Side Validation: Each SM driver should validate sm_config values against on-disk state before using them, on every read - not just on SR scan.

Layer 4 - Audit Logging: Log all sm_config write operations to the XAPI audit trail with full session identity.

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