Skip to main content
Vulnerability Database/CVE-2025-58147

CVE-2025-58147: Xen Buffer Overflow Vulnerability

CVE-2025-58147 is a buffer overflow vulnerability in Xen hypervisor affecting Viridian hypercall processing. Out-of-bounds writes occur when converting vCPU bitmaps. This article covers technical details, impact, and fixes.

Updated:

CVE-2025-58147 Overview

CVE-2025-58147 is an out-of-bounds write vulnerability in the Xen hypervisor's Viridian (Hyper-V compatible) hypercall implementation. Hypercalls using the HV_VP_SET Sparse format can cause the vpmask_set() function to write outside the bounds of its target buffer when converting a guest-supplied bitmap into Xen's internal vCPU mask format. The flaw stems from missing boundary checks on vCPU ID inputs supplied by guest virtual machines. The vulnerability is tracked as [CWE-125] and was disclosed in Xen Project Advisory XSA-475.

Critical Impact

A malicious guest with the ability to issue Viridian hypercalls can trigger memory corruption inside the hypervisor, leading to host-level denial of service and potential host compromise affecting all co-resident guests.

Affected Products

  • Xen hypervisor versions supporting Viridian (Hyper-V compatible) hypercalls
  • Systems running HVM guests with the viridian=1 option enabled
  • Multi-tenant virtualization hosts exposing Viridian enlightenments to guests

Discovery Timeline

  • 2025-10-21 - Issue disclosed publicly via the Openwall OSS Security List
  • 2025-10-31 - CVE-2025-58147 published to NVD
  • 2026-01-14 - Last updated in NVD database

Technical Details for CVE-2025-58147

Vulnerability Analysis

Xen exposes a set of Viridian hypercalls that emulate Microsoft Hyper-V interfaces for Windows guests. Several of these hypercalls accept a mask of target virtual CPU (vCPU) IDs in one of three formats, including the HV_VP_SET Sparse format. Xen translates these guest-supplied representations into its internal vCPU bitmap before routing operations such as inter-processor interrupts.

The vpmask_set() function performs this translation but fails to validate that the converted indices fall within the bounds of the destination bitmap. A guest can craft hypercall input that drives the function to write past the end of the mask structure. Because the write occurs in hypervisor context, it corrupts memory belonging to Xen itself rather than the calling guest. A companion issue, CVE-2025-58148, affects send_ipi() with out-of-bounds reads on d->vcpu[].

Root Cause

The root cause is missing boundary validation on guest-controlled vCPU identifier inputs before they are used as array or bitmap indices. Xen trusts the caller to supply IDs within the configured max_vcpus range and does not clamp or reject values that exceed the internal mask width.

Attack Vector

Exploitation requires a guest capable of invoking Viridian hypercalls, which is the standard configuration for Windows HVM guests on Xen. The attacker constructs an HV_VP_SET Sparse input that encodes vCPU IDs beyond the guest's allocated range. When Xen processes the hypercall, vpmask_set() writes attacker-influenced bits into adjacent hypervisor memory. The vulnerability is reachable from the guest kernel without any host-side authentication.

The Xen Project advisory documents the affected hypercall paths and patched commits. See Xen Project Advisory XSA-475 for the full technical write-up and patch references.

Detection Methods for CVE-2025-58147

Indicators of Compromise

  • Unexpected Xen hypervisor crashes, panics, or BUG_ON traps originating in Viridian hypercall handlers
  • Guest VMs issuing high volumes of HVCALL_SEND_IPI or HVCALL_FLUSH_VIRTUAL_ADDRESS_* calls with anomalous vCPU set encodings
  • Host log entries referencing vpmask_set or send_ipi faults

Detection Strategies

  • Audit Xen build versions and the viridian HVM option across the fleet to identify exposed hosts
  • Correlate guest hypercall telemetry with hypervisor stability events to surface guests probing Viridian interfaces
  • Monitor for guests that enable Viridian enlightenments but issue malformed HV_VP_SET payloads

Monitoring Recommendations

  • Forward xl dmesg and /var/log/xen/ output to centralized logging for anomaly detection
  • Alert on repeated hypervisor exceptions tied to a single guest domain ID
  • Track patch state of Xen packages via configuration management inventory

How to Mitigate CVE-2025-58147

Immediate Actions Required

  • Apply the Xen patches referenced in Xen Project Advisory XSA-475 to all affected hypervisors
  • Inventory HVM guests configured with viridian=1 and prioritize patching hosts that run untrusted tenant workloads
  • Restart affected hosts after patching to load the updated hypervisor binary

Patch Information

The Xen Project has published source patches in XSA-475 addressing both CVE-2025-58147 and CVE-2025-58148. Downstream distributions including major Linux vendors are shipping rebuilt Xen packages. Administrators should track their distribution's security tracker for the corresponding package version and rebuild custom Xen builds against the upstream patches.

Workarounds

  • Disable Viridian enlightenments by setting viridian=0 in HVM guest configuration files where the option is not required
  • Restrict guest creation to trusted operators until patches are applied on multi-tenant hosts
  • Consider live-migrating sensitive workloads to patched hosts ahead of broad rollout
bash
# Disable Viridian enlightenments in an HVM guest configuration
# /etc/xen/<guest>.cfg
viridian = 0

# Verify installed Xen version after patching
xl info | grep xen_version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.