[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh_userauth_none crashes


Yes, both your code and logs seems fine.

The runtime error indicates write past the end of a heap buffer.

Did you tried using this code connect to another relatively new version of OpenSSH server?

BTW, which ssl library did you linked with, libcrypt or openssl?

Yang

> On Oct 19, 2015, at 14:59, Sruthi Mohan (RBEI/EIA1) <Sruthi.Mohan@xxxxxxxxxxxx> wrote:
> 
> [2015/10/19 12:17:57.004000, 2] ssh_connect: libssh 0.7.0 (c) 2003-2014 Aris Adamantiadis, Andreas Schneider, and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_noop
> [2015/10/19 12:18:01.098046, 3] getai: host 10.164.125.76 matches an IP address
> [2015/10/19 12:18:01.156075, 2] ssh_socket_connect: Nonblocking connection socket: 716
> [2015/10/19 12:18:01.156075, 2] ssh_connect: Socket connecting, now waiting for the callbacks to work
> [2015/10/19 12:18:01.156075, 3] ssh_connect: Actual timeout : 10000
> [2015/10/19 12:18:01.159076, 3] ssh_socket_pollcallback: Received POLLOUT in connecting state
> [2015/10/19 12:18:01.159076, 1] socket_callback_connected: Socket connection callback: 1 (0)
> [2015/10/19 12:18:01.172083, 3] callback_receive_banner: Received banner: SSH-2.0-dropbear_0.51
> [2015/10/19 12:18:01.172083, 1] ssh_client_connection_callback: SSH server banner: SSH-2.0-dropbear_0.51
> [2015/10/19 12:18:01.172083, 1] ssh_analyze_banner: Analyzing banner: SSH-2.0-dropbear_0.51
> [2015/10/19 12:18:01.172083, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket
> [2015/10/19 12:18:01.174084, 3] ssh_packet_socket_callback: packet: read type 20 [len=356,padding=10,comp=345,payload=345]
> [2015/10/19 12:18:01.174084, 3] ssh_packet_process: Dispatching handler for packet type 20
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: kex algos: diffie-hellman-group1-sha1
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: server host key algo: ssh-rsa
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: encryption client->server: aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc,blowfish-cbc
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: encryption server->client: aes128-cbc,3des-cbc,aes256-cbc,twofish256-cbc,twofish-cbc,twofish128-cbc,blowfish-cbc
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: mac algo client->server: hmac-sha1-96,hmac-sha1,hmac-md5
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: mac algo server->client: hmac-sha1-96,hmac-sha1,hmac-md5
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: compression algo client->server: zlib,none
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: compression algo server->client: zlib,none
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: languages client->server:
> [2015/10/19 12:18:01.174084, 4] ssh_list_kex: languages server->client:
> [2015/10/19 12:18:02.403698, 3] ssh_knownhosts_algorithms: server 10.164.125.76:155 has ssh-rsa in known_hosts
> [2015/10/19 12:18:02.403698, 3] ssh_client_select_hostkeys: Changing host key method to "ssh-rsa"
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: kex algos: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: server host key algo: ssh-rsa
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: encryption client->server: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: encryption server->client: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: mac algo client->server: hmac-sha1,hmac-sha2-256,hmac-sha2-512
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: mac algo server->client: hmac-sha1,hmac-sha2-256,hmac-sha2-512
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: compression algo client->server: none
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: compression algo server->client: none
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: languages client->server:
> [2015/10/19 12:18:02.403698, 4] ssh_list_kex: languages server->client:
> [2015/10/19 12:18:02.403698, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket
> [2015/10/19 12:18:02.403698, 3] packet_send2: packet: wrote [len=388,padding=8,comp=379,payload=379]
> [2015/10/19 12:18:02.403698, 3] packet_send2: packet: wrote [len=140,padding=5,comp=134,payload=134]
> [2015/10/19 12:18:02.403698, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket
> [20
> 15/10/19 12:18:02.688841, 3] ssh_packet
> connected to host
> 0x26a39980
> HEAP:
> Heap block at 26A4D638 modified at 26A4D6F8 past requested size of b8
>  
>  
> The logs seem fine to me.
>  
> Best regards 
> 
> Sruthi Mohan
> RBEI/EIA1
> 
> Tel. +91(80)6783-7826 
> 
> From: Yang Yubo [mailto:yang@xxxxxxxxxxxx <mailto:yang@xxxxxxxxxxxx>] 
> Sent: Monday, October 19, 2015 11:30 AM
> To: libssh@xxxxxxxxxx <mailto:libssh@xxxxxxxxxx>
> Subject: Re: ssh_userauth_none crashes
>  
> Do you have any logs printed by libssh? If you don’t have, use this line to enable logging:
>  
> ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
>  
> Set verbosity to SSH_LOG_FUNCTIONS will reals very detailed info that may provide clues.
>  
> BR,
>  
> Yang
>  
> On Oct 19, 2015, at 13:39, Sruthi Mohan (RBEI/EIA1) <Sruthi.Mohan@xxxxxxxxxxxx <mailto:Sruthi.Mohan@xxxxxxxxxxxx>> wrote:
>  
> HI,
> Thanks Yang
> I tried doing ssh_init() and It returns success.
> The problem still persists.
> Checked mySshSession before ssh_userauth_none  .it is still valid.
>  
> The device perfectly logs in with putty.
> Could it be something to do with device permissions? The same code worked earlier. I don’t remember changing the code, Now its giving issues.
> It would be great If somebody can help.
>  
> Sample code below:
> ssh_init();
>     ssh_options_set(mySshSession, SSH_OPTIONS_HOST, IPAddress.toStdString().c_str());
>     ssh_options_set(mySshSession, SSH_OPTIONS_PORT, &port);
>     ssh_options_set(mySshSession, SSH_OPTIONS_USER, User.toStdString().c_str());
>  
>     rc = ssh_connect(mySshSession);
>     if (rc==SSH_OK)
>     {
> int rc =ssh_userauth_none(mySshSession, NULL);
>     if (ssh_pki_import_pubkey_file(PublickeyFile.toStdString().c_str(), &pubkey) != SSH_OK) {
>         qDebug()<<"Failed to import the key";
>         return DDM_ERR;
>     }
>     }
>     }
>  
>  
> Best regards 
> 
> Sruthi Mohan
> RBEI/EIA1
> 
> Tel. +91(80)6783-7826 
> 
> 
> From: Yang Yubo [mailto:yang@xxxxxxxxxxxx <mailto:yang@xxxxxxxxxxxx>] 
> Sent: Sunday, October 18, 2015 7:54 AM
> To: libssh@xxxxxxxxxx <mailto:libssh@xxxxxxxxxx>
> Subject: Re: ssh_userauth_none crashes
>  
> Did you called ssh_init() function to init libssh library?
>  
> /**
>  * @brief Initialize global cryptographic data structures.
>  *
>  * This function should only be called once, at the beginning of the program, in
>  * the main thread. It may be omitted if your program is not multithreaded.
>  *
>  * @returns             0 on success, -1 if an error occured.
>  */
> int ssh_init(void);
>  
> BR,
>  
> Yang
>  
> On Oct 18, 2015, at 10:06, Sruthi Mohan (RBEI/EIA1) <Sruthi.Mohan@xxxxxxxxxxxx <mailto:Sruthi.Mohan@xxxxxxxxxxxx>> wrote:
>  
> HI,
>  
> Attached files for SSH,
> Could be hempful if you could check
>  
> From: Yang Yubo [mailto:yang@xxxxxxxxxxxx <mailto:yang@xxxxxxxxxxxx>] 
> Sent: Friday, October 16, 2015 6:43 PM
> To: libssh@xxxxxxxxxx <mailto:libssh@xxxxxxxxxx>
> Subject: Re: ssh_userauth_none crashes
>  
> Hi Sruthi,
>  
> I use libssh in one of my application, didn’t ever encounter such ssh_userauth_none crash error.
>  
> It looks like some mySshSession was released or point to another memory address.
>  
> I think it would be better if you could paste full example code that can reproduce the issue.
>  
> Best
>  
> Yang
>  
> On Oct 16, 2015, at 18:59, Sruthi Mohan (RBEI/EIA1) <Sruthi.Mohan@xxxxxxxxxxxx <mailto:Sruthi.Mohan@xxxxxxxxxxxx>> wrote:
>  
> Dear sir,
> I am using libssh 0.7
> I have followed the following steps,
> ssh_connect(mySshSession);=succesful
>  
> Known host verification ==successful
>  
> ssh_userauth_none(mySshSession, NULL);
>  
> ssh_userauth_none crashes with the error
> Heap block at 27415180 modified at 27415240 past requested size of b8.
>  
> Any help would be appreciated
>  
>  
>  
> Best regards
>  
> Sruthi Mohan 
> RBEI/EIA1
>  
> Tel. +91(80)6783-7826
>  
> <myipconnect.cpp><myipconnect.h><datatypes.h>


References:
ssh_userauth_none crashes"Sruthi Mohan (RBEI/EIA1)" <Sruthi.Mohan@xxxxxxxxxxxx>
Re: ssh_userauth_none crashesYang Yubo <yang@xxxxxxxxxxxx>
RE: ssh_userauth_none crashes"Sruthi Mohan (RBEI/EIA1)" <Sruthi.Mohan@xxxxxxxxxxxx>
Re: ssh_userauth_none crashesYang Yubo <yang@xxxxxxxxxxxx>
RE: ssh_userauth_none crashes"Sruthi Mohan (RBEI/EIA1)" <Sruthi.Mohan@xxxxxxxxxxxx>
Re: ssh_userauth_none crashesYang Yubo <yang@xxxxxxxxxxxx>
RE: ssh_userauth_none crashes"Sruthi Mohan (RBEI/EIA1)" <Sruthi.Mohan@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org