CVE-2026-66032 in libssh2info

Summary

by MITRE • 07/24/2026

libssh2 through 1.11.1, fixed in commit 5e47761, contains a double-free vulnerability in the sftp_open() function in src/sftp.c that allows a malicious SSH server to corrupt the heap of any authenticated client opening an SFTP session. When a server responds to SSH_FXP_OPEN with SSH_FXP_STATUS containing FX_OK, the response data buffer is freed, and if a subsequent sftp_packet_require() call returns a specific error such as LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED, the same pointer is freed a second time, enabling tcache dup conditions on glibc systems that allow overlapping allocations and function pointer overwrites.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 07/24/2026

This vulnerability affects libssh2 versions through 1.11.1 and represents a critical heap corruption issue in the SFTP client implementation that can be exploited by malicious SSH servers to achieve arbitrary code execution. The flaw exists in the sftp_open() function within src/sftp.c where improper memory management leads to a double-free condition during SFTP session establishment, making it particularly dangerous for clients connecting to untrusted SSH servers.

The technical implementation of this vulnerability stems from a specific sequence of operations within the SFTP protocol handling code. When an SSH server responds to an SSH_FXP_OPEN request with an SSH_FXP_STATUS message containing FX_OK status, the code frees a response data buffer that contains the packet data. However, subsequent error handling logic in sftp_packet_require() can trigger a second free operation on the same memory pointer when specific error conditions occur such as LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED. This double-free condition creates tcache duplication opportunities on glibc systems where freed memory chunks are placed in thread-local caches rather than being returned to the main heap, enabling attackers to manipulate memory layout through controlled allocations.

The operational impact of this vulnerability extends beyond simple heap corruption to potentially enable full system compromise when exploited effectively. The overlapping memory allocation conditions created by tcache duplication can be leveraged to overwrite function pointers or other critical data structures in the client process, providing attackers with opportunities for privilege escalation or arbitrary code execution. This makes the vulnerability particularly dangerous for applications that use libssh2 for SFTP operations and connect to untrusted SSH servers. The vulnerability affects any application using libssh2 versions prior to 1.11.2 where the fix commit 5e47761 was applied, including various SSH clients, file transfer utilities, and network management tools.

Mitigation strategies should focus on immediate patching of affected libssh2 versions to ensure the double-free condition is eliminated through proper memory management in the sftp_open() function. System administrators should prioritize updating all applications that depend on libssh2 to versions containing the fix, particularly those handling SFTP connections to potentially malicious servers. Additional protective measures include implementing network segmentation to limit exposure to untrusted SSH servers, using SSH key authentication with strict host verification to prevent man-in-the-middle attacks, and monitoring for unusual connection patterns or memory allocation behavior that might indicate exploitation attempts. Organizations should also consider implementing application-level sandboxing or containerization for SFTP clients to limit potential damage from successful exploitation attempts. This vulnerability aligns with CWE-415: Double Free and is categorized under ATT&CK technique T1210: Exploitation of Remote Services, representing a critical security gap that requires immediate remediation across all affected systems.

Responsible

VulnCheck

Reservation

07/23/2026

Disclosure

07/24/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!