Skip to content
Vulnerabilities

libssh2 Vulnerabilities Allow a Malicious SSH Server to Corrupt Client Memory

A set of high-severity vulnerabilities in libssh2 could expose SSH and SFTP client applications to memory corruption, crashes, and potential code execution when connecting to a malicious server. libssh2 is a widely used C library that provides support for the SSH2 protocol in various applications, i...

· Jul 28, 2026 · 3 min read · 👁 0 views
libssh2 Vulnerabilities Allow a Malicious SSH Server to Corrupt Client Memory

A set of high-severity vulnerabilities in libssh2 could expose SSH and SFTP client applications to memory corruption, crashes, and potential code execution when connecting to a malicious server.

libssh2 is a widely used C library that provides support for the SSH2 protocol in various applications, including remote administration tools, file transfers, automated deployment tools, backup platforms, and SFTP clients.

Four vulnerabilities were disclosed on July 24, 2026, affecting libssh2 versions 1.11.1 and earlier. Each vulnerability has been addressed in separate upstream commits.

libssh2 Vulnerabilities

The most critical bug, tracked as CVE-2026-66032, is a double-free flaw in the sftp_open() function located in src/sftp.c. It has a CVSS score of 8.7 and is classified as CWE-415 (Double Free).

This flaw occurs after an authenticated client opens an SFTP session. A malicious SSH server can respond to an SSH_FXP_OPEN request with a crafted success status. Under certain error conditions, libssh2 inadvertently frees the same response-data buffer twice.

On systems using the glibc heap allocator, this can lead to tcache duplication and overlapping memory allocations. An attacker may exploit this to corrupt application memory and potentially overwrite function pointers. This vulnerability is fixed in commit 5e47761.

The second issue, CVE-2026-66033, affects the ssh2_cipher_crypt() function in src/openssl.c. This pre-authentication vulnerability has a CVSS score of 8.7 and is related to integer underflow and out-of-bounds read weaknesses.

A malicious server can negotiate AES-GCM encryption during the SSH handshake, which may trigger an underflow in the packet size calculation.

This can cause an out-of-bounds read and invoke memcpy() with a near-maximum size value, resulting in an immediate client crash before authentication. The fix for this issue is available in commit a2ed82d.

Two additional vulnerabilities could also lead to memory corruption. CVE-2026-66034 impacts the public-key subsystem, where a malicious server can supply an unsafe length value, causing the parser to read beyond the allocated heap buffer. The error-handling path may also free an uninitialized pointer. This flaw is fixed in commit a13bb6c.

CVE-2026-66035 is a pre-authentication heap buffer overflow found in the fullpacket() function in src/transport.c. During the Encrypt-then-MAC cipher negotiation, a malicious server can send a packet smaller than the negotiated cipher block size.

This results in the library allocating an insufficient buffer and copying more data than it can hold. This vulnerability is addressed in commit 42e33d8.

Organizations are encouraged to update libssh2 to a version that includes all four fixes or to rebuild the library with the referenced upstream patches.

Additionally, teams should identify any software packages that statically bundle libssh2, as simply updating the operating system package may not resolve all affected applications.

Source: CybersecurityNews.com

Follow ShomoySoft for more: Follow on Facebook

💬 Comments (0)

Login to join the discussion.

No comments yet. Be the first!

Recommended for you