[pve-devel] [PATCH qemu-server v7 1/5] disk import: add additional safeguards for imported image files

Dominik Csapak d.csapak at proxmox.com
Mon Nov 18 16:29:15 CET 2024


From: Fabian Grünbichler <f.gruenbichler at proxmox.com>

creating non-raw disk images with arbitrary content is only possible with raw
access to the storage, but checking for references to external files doesn't
hurt, in case for non pve-managed volumes.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
 [ DC: removed problematic checks for pve-managed volumes ]
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v6:
* remove unrelated hunks

 PVE/API2/Qemu.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index c50c42be..528ec6d1 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -442,7 +442,8 @@ my sub create_disks : prototype($$$$$$$$$$) {
 		    }
 		} else {
 		    $source = PVE::Storage::abs_filesystem_path($storecfg, $source, 1);
-		    ($size, my $source_format) = PVE::Storage::file_size_info($source);
+		    # check potentially untrusted image file!
+		    ($size, my $source_format) = PVE::Storage::file_size_info($source, undef, 1);
 		    die "could not get file size of $source\n" if !$size;
 
 		    if ($live_import && $ds ne 'efidisk0') {
-- 
2.39.5





More information about the pve-devel mailing list