CVE-2024-31145 Overview
CVE-2024-31145 is a memory access control vulnerability affecting the Xen hypervisor that arises from flawed error handling in the management of Reserved Memory Regions (RMRR) for Intel VT-d and Unity Mapping ranges for AMD-Vi. These regions are typically assigned to certain PCI devices for platform tasks such as legacy USB emulation. When error handling fails during the establishment of these memory mappings, the mappings may persist when they should have been removed, allowing guest virtual machines to gain unauthorized access to memory regions they should not be able to read or modify.
Critical Impact
Guest virtual machines can potentially access memory regions outside their intended boundaries, breaking VM isolation and enabling information disclosure or data corruption across VM boundaries.
Affected Products
- Xen Hypervisor (x86 architecture)
- Systems using Intel VT-d with RMRR configurations
- Systems using AMD-Vi with Unity Mapping ranges
Discovery Timeline
- 2024-09-25 - CVE CVE-2024-31145 published to NVD
- 2026-01-05 - Last updated in NVD database
Technical Details for CVE-2024-31145
Vulnerability Analysis
This vulnerability stems from improper resource management in Xen's IOMMU (Input/Output Memory Management Unit) handling code. PCI devices in virtualized environments may require access to Reserved Memory Region Reporting (RMRR) regions for Intel VT-d or equivalent Unity Mapping ranges for AMD-Vi. These reserved memory regions serve platform-specific purposes such as USB controller legacy emulation and must remain accessible to their associated devices while those devices are active.
The flaw exists in the error handling logic that manages these memory mappings. Under certain error conditions, the cleanup code fails to properly remove memory mappings that were established for these reserved regions. This results in stale mappings remaining in place, which can inadvertently grant guest virtual machines access to memory regions outside their authorized address space.
The vulnerability requires local access and high privileges to exploit, but its impact is significant because it can break the fundamental isolation guarantees that hypervisors provide between virtual machines. A malicious or compromised guest with the right conditions could potentially read sensitive data from other guests or the hypervisor itself.
Root Cause
The root cause is a Resource Exhaustion vulnerability (CWE-400) combined with improper error handling in the IOMMU mapping logic. When the Xen hypervisor encounters an error while establishing RMRR or Unity Mapping regions for PCI devices, the error handling path does not correctly reverse all previously completed mapping operations. This leaves mappings in an inconsistent state where they remain accessible to guests that should no longer have permissions to those memory regions.
The vulnerability is particularly concerning because the precise purpose of RMRR regions is often unknown to the hypervisor—they are defined by the platform firmware. This means the hypervisor must maintain continuous access to these regions for associated devices, making proper cleanup on error conditions critical for security.
Attack Vector
The attack vector is local, requiring an attacker to have high-privilege access within a guest virtual machine. The exploitation scenario involves:
- A guest VM with an assigned PCI device that has associated RMRR or Unity Mapping regions
- Triggering an error condition during the memory mapping establishment process
- Exploiting the faulty error handling to retain access to memory mappings that should have been revoked
- Using the retained access to read or potentially write to memory regions belonging to other guests or the hypervisor
The attack complexity is high because it requires specific system configurations and the ability to trigger error conditions in the mapping logic. However, a successful exploit can change the scope from the vulnerable component to other components in the system, affecting confidentiality, integrity, and availability of other virtual machines.
Detection Methods for CVE-2024-31145
Indicators of Compromise
- Unexpected memory access patterns from guest VMs attempting to reach addresses outside their assigned regions
- IOMMU fault logs indicating access to reserved memory regions from unauthorized domains
- Anomalous behavior from VMs with PCI passthrough devices, particularly USB controllers
- Inconsistencies in RMRR or Unity Mapping configurations during system audits
Detection Strategies
- Monitor Xen hypervisor logs for IOMMU-related errors, particularly those involving RMRR or Unity Mapping setup failures
- Implement integrity monitoring on hypervisor memory mapping tables to detect unauthorized mappings
- Deploy hypervisor-level intrusion detection to identify guests attempting to access memory outside their boundaries
- Audit PCI passthrough configurations and associated memory region assignments
Monitoring Recommendations
- Enable verbose IOMMU logging in the Xen hypervisor to capture mapping errors and cleanup operations
- Implement alerting for IOMMU fault events that indicate boundary violations
- Regularly audit memory mappings for guest VMs with assigned PCI devices to identify stale or unauthorized entries
- Monitor system behavior after PCI device assignment changes or VM migrations
How to Mitigate CVE-2024-31145
Immediate Actions Required
- Apply the security patches provided by the Xen Project as documented in XSA-460
- Review all VMs with PCI passthrough configurations, especially those involving devices with RMRR requirements
- Consider temporarily removing PCI passthrough for non-essential devices until patches are applied
- Ensure hypervisor and guest VMs are running supported and updated versions of Xen
Patch Information
The Xen Project has released security patches addressing this vulnerability as part of XSA-460. System administrators should consult the Xen Project Security Advisory XSA-460 for detailed patch information and apply the relevant fixes to their Xen installations. The patches correct the error handling logic to ensure memory mappings are properly cleaned up when errors occur during RMRR or Unity Mapping establishment.
Additional information and discussion can be found in the Openwall OSS Security Discussion.
Workarounds
- Avoid assigning PCI devices with RMRR requirements to untrusted guest VMs until patches are applied
- Limit PCI passthrough to only essential use cases and trusted VMs
- Implement network segmentation to reduce the impact of potential VM escape scenarios
- Consider using alternative virtualization configurations that do not require RMRR-associated device passthrough
# Configuration example - Verify IOMMU status and review PCI passthrough assignments
# Check IOMMU status on the Xen hypervisor
xl dmesg | grep -i iommu
# List PCI devices assigned to guests
xl pci-list <domain-name>
# Review RMRR regions reported by the platform
dmesg | grep -i rmrr
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


