CVE-2015-5313: storage: don't allow '/' in filesystem volume names
The libvirt file system storage driver determines what file to
act on by concatenating the pool location with the volume name.
If a user is able to pick names like "../../../etc/passwd", then
they can escape the bounds of the pool. For that matter,
virStoragePoolListVolumes() doesn't descend into subdirectories,
so a user really shouldn't use a name with a slash.
Normally, only privileged users can coerce libvirt into creating
or opening existing files using the virStorageVol APIs; and such
users already have full privilege to create any domain XML (so it
is not an escalation of privilege). But in the case of
fine-grained ACLs, it is feasible that a user can be granted
storage_vol:create but not domain:write, and it violates
assumptions if such a user can abuse libvirt to access files
outside of the storage pool.
Therefore, prevent all use of volume names that contain "/",
whether or not such a name is actually attempting to escape the
pool.
This changes things from:
$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
Vol ../../../../../../etc/haha created
$ rm /etc/haha
to:
$ virsh vol-create-as default ../../../../../../etc/haha --capacity 128
error: Failed to create vol ../../../../../../etc/haha
error: Requested operation is not valid: volume name '../../../../../../etc/haha' cannot contain '/'
Signed-off-by: NEric Blake <eblake@redhat.com>
-
mentioned in commit 14828a59
-
mentioned in commit 692ce509
-
mentioned in commit e8643ef6
-
mentioned in commit dcce6659
-
mentioned in commit dc2db111
-
mentioned in commit d414ecb8
-
mentioned in commit 02d365da
-
mentioned in commit 53ae31bf
-
mentioned in commit 0060c4ee
-
mentioned in commit b5ddfbc0
-
mentioned in commit b553ec76
-
mentioned in commit 6410a227
-
mentioned in commit 01cbfeb7
-
mentioned in commit 3e6b40e5
-
mentioned in commit 08acad56
-
mentioned in commit d0357966
-
mentioned in commit 69548d20
-
mentioned in commit 6542e643
-
mentioned in commit edeef640
-
mentioned in commit 29b4ce46
-
mentioned in commit 91898c60
-
mentioned in commit c9450f4f
-
mentioned in commit 890fc0f1
-
mentioned in commit 6ae43393
-
mentioned in commit 4ed80746
-
mentioned in commit 54be99a7
-
mentioned in commit b0f88836
-
mentioned in commit 1d8bcbb7