php.net |  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
Votes:1
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-01-08 12:03 UTC] audioguy at airmail dot net
Description:
------------
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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 :
http://curl.haxx.se/mail/lib-2006-11/0165.html
 [2009-01-10 14:49 UTC] mikesul@php.net
I believe this issue is addressed in libssh2 0.18. Please try it with that.
 [2009-02-08 09:50 UTC] mikesul@php.net
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-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 02 14:01:23 2021 UTC