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::Helper::SSH2::Expect - An Expect like module for Net::SSH2

DESCRIPTION

This is a module to have expect like features for Net::SSH2. This is the first version of this module. Please report bugs at GitHub https://github.com/krimdomu/net-ssh2-expect

DEPENDENCIES

SYNOPSIS

use Rex::Helper::SSH2::Expect;

my $exp = Rex::Helper::SSH2::Expect->new($ssh2);
$exp->spawn("passwd");
$exp->expect($timeout, [
                 qr/Enter new UNIX password:/ => sub {
                                         my ($exp, $line) = @_;
                                         $exp->send($new_password);
                                       }
               ],
               [
                 qr/Retype new UNIX password:/ => sub {
                                         my ($exp, $line) = @_;
                                         $exp->send($new_password);
                                       }
               ],
               [
                 qr/passwd: password updated successfully/ => sub {
                                                 my ($exp, $line) = @_;
                                                 $exp->hard_close;
                                               }
               ]);

CLASS METHODS

new($ssh2)

Constructor: You need to parse an connected Net::SSH2 Object.

log_stdout(0|1)

Log on STDOUT.

log_file($file)

Log everything to a file. $file can be a filename, a filehandle or a subRef.

spawn($command, @parameters)

Spawn $command with @parameters as parameters.

soft_close()

Currently only an alias to hard_close();

hard_close();

Stops the execution of the process.

expect($timeout, @match_patters)

This method controls the execution of your process.

send($string)

Send a string to the running command.