CVE-2019-10166
📋 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
- libvirt
📦 What is this software?
Libvirt by Redhat
Libvirt by Redhat
⚠️ 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.
🎯 Exploit Status
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
linuxLimit 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
linuxPrevent 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
- https://access.redhat.com/libvirt-privesc-vulnerabilities
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-10166
- https://security.gentoo.org/glsa/202003-18
- https://access.redhat.com/libvirt-privesc-vulnerabilities
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-10166
- https://security.gentoo.org/glsa/202003-18