From 649661cd5e2e53df4aeccd42d0f2c4e7b8da6fe1 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 7 Dec 2021 21:57:55 -0600 Subject: [PATCH 1/2] SSH2: make login() return false if no valid auth methods are found --- phpseclib/Net/SSH2.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 89e57487..87d07517 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2314,6 +2314,10 @@ class Net_SSH2 } } + if (!count($newargs)) { + return false; + } + foreach ($newargs as $arg) { if ($this->_login_helper($username, $arg)) { return true; From a74707e08052a54430ec525c7d0c03916518989b Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 7 Dec 2021 21:59:24 -0600 Subject: [PATCH 2/2] SSH2: make login() return false if no valid auth methods are found this is an issue if you, for example, login with a PublicKey instead of a PrivateKey --- phpseclib/Net/SSH2.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 89e57487..87d07517 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -2314,6 +2314,10 @@ class Net_SSH2 } } + if (!count($newargs)) { + return false; + } + foreach ($newargs as $arg) { if ($this->_login_helper($username, $arg)) { return true;