CVE-2019-10166

7.8 HIGH

📋 TL;DR

This vulnerability in libvirtd allows read-only clients to modify managed save state files through the virDomainManagedSaveDefineXML() API. If exploited, a local attacker could execute arbitrary code when a domain resumes. Affected systems are those running vulnerable versions of libvirt with managed save functionality enabled.

💻 Affected Systems

Products:
  • libvirt
Versions: libvirt 4.x.x before 4.10.1 and 5.x.x before 5.4.1
Operating Systems: Linux distributions using affected libvirt versions
Default Config Vulnerable: ⚠️ Yes
Notes: Requires managed save functionality to be used by privileged users. Systems using libvirt for virtualization management (KVM, QEMU, etc.) are affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Local privilege escalation to root, allowing complete system compromise and potential lateral movement in virtualized environments.

🟠

Likely Case

Local attacker gains elevated privileges on the host system, potentially accessing other virtual machines or host resources.

🟢

If Mitigated

With proper access controls and patching, impact is limited to denial of service at most.

🌐 Internet-Facing: LOW - This requires local access to the libvirtd socket or API.
🏢 Internal Only: HIGH - Internal users with access to libvirtd API could exploit this for privilege escalation.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires local access to libvirtd socket/API and knowledge of managed save file locations. Proof-of-concept code exists in security advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: libvirt 4.10.1 or 5.4.1 and later

Vendor Advisory: https://access.redhat.com/libvirt-privesc-vulnerabilities

Restart Required: Yes

Instructions:

1. Update libvirt packages to version 4.10.1+ or 5.4.1+ using your distribution's package manager. 2. Restart libvirtd service: 'systemctl restart libvirtd'. 3. Verify the update with 'libvirtd --version'.

🔧 Temporary Workarounds

Restrict libvirtd socket access

linux

Limit access to libvirtd socket to trusted users only

chmod 660 /var/run/libvirt/libvirt-sock
chown root:libvirt /var/run/libvirt/libvirt-sock

Disable managed save

linux

Prevent use of managed save functionality

virsh managedsave-remove <domain>
Set autostart domains to not use managed save

🧯 If You Can't Patch

  • Restrict access to libvirtd socket to only necessary users/groups
  • Audit and remove any existing managed save files from untrusted domains

🔍 How to Verify

Check if Vulnerable:

Check libvirt version: 'libvirtd --version' or 'rpm -q libvirt' or 'dpkg -l libvirt*'. If version is between 4.0.0-4.10.0 or 5.0.0-5.4.0, system is vulnerable.

Check Version:

libvirtd --version

Verify Fix Applied:

Verify libvirt version is 4.10.1+ or 5.4.1+ and check that libvirtd service is running with updated binaries.

📡 Detection & Monitoring

Log Indicators:

  • Unusual virDomainManagedSaveDefineXML API calls from non-privileged users
  • Modifications to /var/lib/libvirt/qemu/save/ files

Network Indicators:

  • Local socket connections to libvirtd from unexpected users

SIEM Query:

source="libvirtd" AND (api_call="virDomainManagedSaveDefineXML" OR path="/var/lib/libvirt/qemu/save/*")

🔗 References

📤 Share & Export