Security Advisories (1)
CVE-2026-94140 (2026-10-21)

Rex versions through 1.16.1 for Perl accept an unknown SSH host key for remote rsync transfers because sync hardcodes StrictHostKeyChecking=no. Every remote branch of sync builds its ssh command with that option, for password authentication, for private-key authentication and for the fallback. The ssh options a caller sets through set_openssh_opt reach the OpenSSH transport but not this command, so there is no configuration that restores host key checking for the transfer. An attacker who can redirect the connection before the real host key is known presents their own and the transfer proceeds: under password authentication sync sends the connection password to that server, an upload writes the selected local files to it, and a download writes what it returns to the local destination.

NAME

Rex::Commands::Rsync - Simple Rsync Frontend

DESCRIPTION

With this module you can sync 2 directories via the rsync command.

Version <= 1.0: All these functions will not be reported.

All these functions are not idempotent.

DEPENDENCIES

Expect

The Expect Perl module is required to be installed on the machine executing the rsync task.

rsync

The rsync command has to be installed on both machines involved in the execution of the rsync task.

SYNOPSIS

use Rex::Commands::Rsync;

sync "dir1", "dir2";

EXPORTED FUNCTIONS

sync($source, $dest, $opts)

This function executes the rsync command on the local machine (where rex is being run) to sync $source and $dest with a remote. The rsync command is invoked with the --recursive --links --verbose --stats options set.

If you want to use sudo, you need to disable requiretty option for this user. You can do this with the following snippet in your sudoers configuration.

Defaults:username !requiretty
UPLOAD - Will upload all from the local directory html to the remote directory /var/www/html.
task "sync", "server01", sub {
  sync "html/*", "/var/www/html", {
   exclude => "*.sw*",
   parameters => '--backup --delete',
  };
};

task "sync", "server01", sub {
  sync "html/*", "/var/www/html", {
   exclude => ["*.sw*", "*.tmp"],
   parameters => '--backup --delete',
  };
};
DOWNLOAD - Will download all from the remote directory /var/www/html to the local directory html.
task "sync", "server01", sub {
  sync "/var/www/html/*", "html/", {
   download => 1,
   parameters => '--backup',
  };
};