Critical libssh2 Vulnerabilities Expose SSH Clients to Attacks

Recent disclosures have unveiled multiple high-severity vulnerabilities in libssh2, a widely utilized C library that implements the SSH2 protocol. These flaws could allow malicious SSH servers to corrupt client memory, leading to crashes and potential code execution.

Libssh2 is integral to numerous applications, including remote administration tools, file transfer utilities, automated deployment systems, backup platforms, and SFTP clients. The identified vulnerabilities affect versions 1.11.1 and earlier, with fixes provided in subsequent upstream commits.

Details of the Vulnerabilities

The most critical issue, designated as CVE-2026-66032, involves a double-free error in the sftp_open() function within src/sftp.c. This flaw, with a CVSS score of 8.7, occurs when a malicious server responds to an SSH_FXP_OPEN request with a crafted success status. Under specific error conditions, libssh2 may inadvertently free the same response-data buffer twice, potentially leading to memory corruption and function pointer overwrites. This vulnerability has been addressed in commit 5e47761.

Another significant vulnerability, CVE-2026-66033, resides in the ssh2_cipher_crypt() function in src/openssl.c. Also rated with a CVSS score of 8.7, this pre-authentication flaw involves integer underflow and out-of-bounds read issues. A malicious server can negotiate AES-GCM encryption during the SSH handshake, triggering an underflow in packet size calculation. This can result in an out-of-bounds read and a subsequent client crash before authentication. The fix is available in commit a2ed82d.

Additional vulnerabilities include CVE-2026-66034, which affects the public-key subsystem. Here, a malicious server can supply an unsafe length value, causing the parser to read beyond the allocated heap buffer and potentially freeing an uninitialized pointer. This issue is resolved in commit a13bb6c.

CVE-2026-66035 is a pre-authentication heap buffer overflow found in the fullpacket() function in src/transport.c. During Encrypt-then-MAC cipher negotiation, a malicious server can send a packet smaller than the negotiated cipher block size, leading to insufficient buffer allocation and data overflow. This vulnerability is addressed in commit 42e33d8.

Organizations are strongly advised to update libssh2 to versions incorporating these fixes or to apply the referenced upstream patches. It’s also crucial to identify and update any software packages that statically bundle libssh2, as merely updating the operating system package may not resolve all affected applications.

These vulnerabilities underscore the importance of regular security assessments and prompt patch management. Given libssh2’s widespread use, timely updates are essential to mitigate potential exploitation risks.