|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68023 Segfault authenticating to servers that do not support authentication
Submitted: 2014-09-16 00:41 UTC Modified: 2015-07-15 07:36 UTC
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: felipe at weckx dot net Assigned: langemeijer (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 5.6.0 OS: Linux 3.16.2-1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: felipe at weckx dot net
New email:
PHP Version: OS:


 [2014-09-16 00:41 UTC] felipe at weckx dot net
Some simpler devices (e.g. older Cisco Devices, Dell SonicWall firewalls, Motorola RFS 7000 switches) implement the SSH service without any authentication (they show a prompt after the connection is established). If a ssh2_auth_password or ssh2_auth_agent is called on a connection to one of these devices a segfault occurs because libssh2_userauth_list returns NULL.

The problem can be prevented by calling ssh2_auth_none and checking if the return value is TRUE, but I believe the ssh2_auth_password should fail gracefully.

Test script:
$host = '';
$port = 2200;
$conn = ssh2_connect($host, $port);
if (!$conn) {
        echo "Error connecting to '{$host}:{$port}'\n";
echo "Connected to '{$host}:{$port}'. Trying password authentication\n";
ssh2_auth_password($conn, 'test', 'test');
echo "OK\n";

Expected result:
Connected to ''. Trying password authentication
Segmentation fault (core dumped)


ssh2-auth-none-segfault-fix (last revision 2014-09-16 00:41 UTC by felipe at weckx dot net)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-15 07:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: langemeijer
 [2015-07-15 07:36 UTC]
Patch is merged into git.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 12:01:23 2021 UTC