cinder/cinder/privsep
Brian Rosmaita d6a186945e CVE-2024-32498: Check for external qcow2 data file
Adds code to image_utils to check for a qcow2 external data
file, a recent feature of qemu which we do not support and
which can be used maliciously.

Advice from the qemu-img community is that it is dangerous
to call qemu-img info on untrusted files, so we copy over
the format_inspector module from Glance.  This performs basic
analysis on the image data file so we can detect problematic
images before we call qemu-img info to get all the image
attributes.  It is expected that this code will eventually be
added to oslo so it can be consumed by Glance, Cinder, and
Nova.

Because cinder itself may create qcow2 format images with a
backing file in nfs-based backends, the glance format_inspector
has been modified to optionally allow such files.  Since we are
monkeying with the format_inspector code, we also copy over
its unit tests to prevent regressions and to add tests for the
changed code.

Includes an additional fix to prevent an issue where a user
could mount a raw volume and write a qcow2 header with a larger
virtual size on it. On reattaching the volume it would have the
new larger virtual size avaialable without actually changing
the size value in cinder.  While we cannot prevent this we can
prevent the user from using this volume again, which makes this
exploit pointless.

Co-authored-by: Dan Smith <dansmith@redhat.com>
Co-authored-by: Felix Huettner <felix.huettner@mail.schwarz>

Change-Id: I65857288b797cde573e7443ac6e7e6f57fedde01
Closes-bug: #2059809
2024-07-02 18:47:11 -04:00
..
targets LVM nvmet: Add support for shared subsystems 2023-02-03 14:56:19 +01:00
__init__.py Implement privsep boilerplate in cinder. 2018-06-06 09:42:54 +08:00
cgroup.py Implement privsep boilerplate in cinder. 2018-06-06 09:42:54 +08:00
format_inspector.py CVE-2024-32498: Check for external qcow2 data file 2024-07-02 18:47:11 -04:00
fs.py Revert "Remove truncate from rootwrap filters" 2019-03-06 10:08:10 -05:00
lvm.py Replace 'lvconvert' from rootwrap 2019-02-17 14:33:31 -05:00
path.py LVM-nvmet: Use nvmetcli as library instead of CLI 2022-11-24 15:38:41 +01:00