[pbs-devel] [PATCH v3 proxmox-backup 14/20] file-restore: add qemu-helper setuid binary

Oguz Bektas o.bektas at proxmox.com
Wed Mar 31 16:15:30 CEST 2021


hi,

On Wed, Mar 31, 2021 at 12:21:56PM +0200, Stefan Reiter wrote:
> +    // Try starting QEMU in a loop to retry if we fail because of a bad 'cid' value
> +    let mut attempts = 0;
> +    loop {
> +        let mut qemu_cmd = std::process::Command::new("qemu-system-x86_64");
> +        qemu_cmd.args(base_args.iter());

is vulnerable to path confusion, since setuid helper can be called directly by
unprivileged user.


please add this:

==================================================

diff --git a/src/bin/proxmox-restore-qemu-helper.rs b/src/bin/proxmox-restore-qemu-helper.rs
index f56a6607..ad707d69 100644
--- a/src/bin/proxmox-restore-qemu-helper.rs
+++ b/src/bin/proxmox-restore-qemu-helper.rs
@@ -212,6 +212,7 @@ async fn start_vm(
 
     // Try starting QEMU in a loop to retry if we fail because of a bad 'cid' value
     let mut attempts = 0;
+
     loop {
         let mut qemu_cmd = std::process::Command::new("qemu-system-x86_64");
         qemu_cmd.args(base_args.iter());
@@ -349,6 +350,7 @@ async fn start(param: Value) -> Result<Value, Error> {
 }
 
 fn main() -> Result<(), Error> {
+    proxmox_backup::tools::setup_safe_path_env();
     let effective_uid = nix::unistd::Uid::effective();
     if !effective_uid.is_root() {
         bail!("this program needs to be run with setuid root");

==================================================

and then it should be alright from some quick tests...

maybe it also makes sense to add this in the backup client too.





More information about the pbs-devel mailing list