CVE-2026-66035 in libssh2info

Summary

by MITRE • 07/24/2026

libssh2 through 1.11.1, fixed in commit 42e33d8, contains a pre-authentication heap buffer overflow vulnerability that allows a malicious SSH server to corrupt heap metadata in any connecting client by sending a packet with a packet_length smaller than the cipher's block size during Encrypt-then-MAC cipher negotiation. In the fullpacket() function in src/transport.c, the ETM path allocates a buffer of packet_length bytes but copies blocksize minus one bytes via memcpy, causing an overflow that on 32-bit glibc writes attacker-controlled bytes into an adjacent chunk's SIZE field, enabling tcache bin confusion, overlapping live objects, and function pointer overwrite during the session handshake before authentication.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 07/25/2026

This vulnerability resides in libssh2 versions up to 1.11.1 and represents a critical pre-authentication heap buffer overflow that can be exploited by malicious SSH servers to compromise client systems. The flaw exists in the fullpacket() function within src/transport.c where the Encrypt-then-MAC (ETM) path handles packet processing during cipher negotiation. When an attacker-controlled SSH server sends a packet with a packet_length smaller than the cipher's block size, the vulnerability is triggered through improper memory management that creates a condition allowing heap metadata corruption.

The technical implementation of this vulnerability involves a specific buffer allocation and copying pattern that creates the overflow condition. The system allocates a buffer sized exactly to packet_length bytes but then uses memcpy to copy blocksize minus one bytes from the incoming packet data. This discrepancy between allocated buffer size and actual data copied creates a situation where the final byte of the allocated buffer receives data from an adjacent memory region, effectively overwriting heap metadata structures.

The operational impact of this vulnerability is severe as it enables attackers to manipulate heap metadata in ways that can lead to arbitrary code execution or denial of service conditions. On 32-bit glibc systems, the overflow specifically targets adjacent chunk's SIZE field, which allows for tcache bin confusion - a condition where the heap allocator's internal bookkeeping becomes corrupted. This corruption can result in overlapping live objects within the heap memory space, creating opportunities for function pointer overwrites during the session handshake process before authentication occurs.

This vulnerability maps to CWE-121 for heap-based buffer overflow and CWE-125 for out-of-bounds read conditions in the context of memory safety. From an adversarial perspective, it aligns with ATT&CK technique T1566.002 for phishing with malicious attachments or links that could establish the malicious SSH server scenario, and potentially T1059 for command and scripting interpreter usage if exploitation leads to code execution. The pre-authentication nature of this vulnerability means that any client connecting to a compromised SSH server could be affected without requiring prior authentication credentials.

Mitigation strategies should focus on immediate patch application to libssh2 versions containing the fix from commit 42e33d8, which properly validates packet_length values against cipher block sizes before buffer allocation. System administrators should also implement network-level controls to restrict SSH server access to trusted sources only, and consider implementing additional monitoring for unusual packet patterns during SSH handshakes. Organizations using libssh2 in their applications should conduct thorough code reviews to ensure proper validation of packet lengths and cipher parameters, particularly when implementing custom SSH client functionality that may interact with untrusted servers.

Responsible

VulnCheck

Reservation

07/23/2026

Disclosure

07/24/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

medium

Sources

Do you need the next level of professionalism?

Upgrade your account now!