The following issue was reported as affecting libssh2:
When negotiating a new SSH session with a remote server, one of libssh2's functions for doing the key exchange (kexagreemethods) was naively reading data from the incoming packet and using it without doing sufficient range checks. The SSHMSGKEXINIT packet arrives to libssh2 with a set of strings, sent as a series of LENGTH + DATA pairs. libssh2 would go through the list and read the LENGTH field, read the string following the LENGTH and then advance the pointer LENGTH bytes in memory and expect to find the next LENGTH + DATA pair there. Then move on until seven subsequent strings are taken care of. It would naively assume that the (unsigned 32 bit) LENGTH fields were fine.
This packet arrives in the negotiating phase so the remote server has not yet been deemed to be a known or trusted party.
A malicious attacker could man in the middle a real server and cause libssh2 using clients to crash (denial of service) or otherwise read and use completely unintended memory areas in this process.
There are no known exploits of this flaw at this time.