Daniel Berrange discovered that libvirt fails to check whether connection to libvirtd is in read-only or read-write mode, possibly allowing non-privileged users with access to the host machine to perform certain actions that should be restricted to administrative users only.
The following methods in libvirt.c are missing a check against the read-only connection flag:
In recent versions, libvirt uses PolicyKit to authorize connections from users. Default policy allows any local user to connect in the read-only mode.
Older versions of libvirt, or version not compiled with PolicyKit or with PolicyKit authorization disabled, default to allow read-only connections to all local users.
Thus out of the box unprivileged local users may be able to migrate VMs, set or unset the autostart flag for domains, networks & storage pools, and access privileged data in the VM memory, or disks.
All TCP remote connections are read-write, and fully authenticated, thus not impacted.
Created attachment 326995 [details]
Upstream patch against 0.5.1
In version of libvirt as shipped in Red Hat Enterprise Linux 5, only following APIs are affected:
Additionally, Xen hypervisor does not allow libvirt to set autostart flag for Xen domains.
Public now via:
As mentioned in the upstream announcement, it is possible to use a work-around to block exploitation of this flaw by changing default setting that allow read-only access to any local user. Steps how to to that depend on what authentication is configured to be used for connections on local unix sockets.
libvirt versions built with support for PolicyKit default to PolicyKit authentication and authorization. PolicyKit action org.libvirt.unix.monitor is used as an authorization for read-only access, and is granted to all local users by default. By changing the policy (e.g. using polkit-gnome-authorization), you can restrict this action by default, and only grant it to selected local users (optionally requiring authentication). Alternatively, you can disable PolicyKit authorization by setting auth_unix_ro / auth_unix_rw to none in /etc/libvirt/libvirtd.conf and following instructions below.
libvirt versions built without support for PolicyKit (e.g. as used in Red Hat Enterprise Linux 5) use socket file system permissions to control which local users can establish read-only and read-write connections. Two separate sockets are used - libvirt-sock (read-write connections) and libvirt-sock-ro (read-only connections), located in /var/run/libvirt/. Default permissions of those sockets on Red Hat Enterprise Linux 5 are 700 and 777 respectively, orwned by root:root. Those default permissions can be changed by adding following configuration directives to the /etc/libvirt/libvirtd.conf configuration file.
If you only want root user to be able to make read-only connections to libvirtd, add:
unix_sock_ro_perms = "0700"
If you want to allow read-only access to some trusted group of unprivileged users, create new unix group (e.g. virtro) containing all those users and add following to libvirtd.conf:
unix_sock_group = "virtro"
unix_sock_ro_perms = "0770"
You have to restart libvirtd after changing its configuration file for changes to take effect.
libvirt-0.5.1-2.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
libvirt-0.5.1-2.fc10 has been pushed to the Fedora 10 stable repository. If problems still persist, please make note of it in this bug report.
This issue has been addressed in following products:
Red Hat Enterprise Linux 5
Via RHSA-2009:0382 https://rhn.redhat.com/errata/RHSA-2009-0382.html
This issue was addressed in:
Red Hat Enterprise Linux: