|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57996 ssh2_connect causes 100% CPU Usage
Submitted: 2008-01-08 12:03 UTC Modified: 2009-02-08 09:50 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: audioguy at airmail dot net Assigned:
Status: No Feedback Package: ssh2 (PECL)
PHP Version: 5.2.1 OS: Linux
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: audioguy at airmail dot net
New email:
PHP Version: OS:


 [2008-01-08 12:03 UTC] audioguy at airmail dot net
When trying to connect to an ssh server that is returning:
ssh_exchange_identification: Connection closed by remote host

My php process hits 100% until I kill the pid, no error is ever returned.

An example would be an ssh server that has your ip in host.deny, although in my case I am having a problem with mikrotik routers that are sometimes bombing on ssh.

Reproduce code:
$host = "your.ip";
$methods = array(
  'kex' => 'diffie-hellman-group1-sha1',
  'client_to_server' => array(
   'crypt' => '3des-cbc',
   'comp' => 'none'),
  'server_to_client' => array(
   'crypt' => 'aes256-cbc,aes192-cbc,aes128-cbc',
   'comp' => 'none'));
$ssh_con = ssh2_connect($host,22,$methods);

Expected result:
for $ssh_con to return a connection error.

Actual result:
no visual response, the process hits 100% CPU usage


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-17 17:46 UTC] news dot francoisxavier at free dot fr
Reproduced with :
PHP v5.2.5
php_ssh2.dll v5.2.1.1
Windows XP SP2
libeay32.dll v0.9.8.5

  I had the same problem with a SSH server that have the following action :
  -TCP connection on port 22 OK
  -but the server never transmit its banner (protocol)

  It seems to be a problem in OpenSSL rather than php_ssh2 :
 [2009-01-10 14:49 UTC]
I believe this issue is addressed in libssh2 0.18. Please try it with that.
 [2009-02-08 09:50 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2011-12-11 15:12 UTC] admin at seisho dot us
The 100% cpu is triggerd also by scp if it is not found...
For example one of my centos, hasn't the scp command...
ssh2_scp_recv triggered the bug.

Using libssh2 = 1.29
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Sep 28 00:03:57 2022 UTC