libssh2 Fixes High-Severity Double-Free in `sftp_open()`
Vulnerability Disclosure · 6 sources · Updated 4mo ago · First seen Jul 24, 2026

A high-severity memory-safety flaw tracked as CVE-2026-66032 was disclosed in libssh2 through version 1.11.1, affecting the sftp_open() function in src/sftp.c. The bug allows a malicious SSH server to trigger a double free in an authenticated client that opens an SFTP session, creating heap corruption conditions. Advisory details say the issue occurs when the server responds to SSH_FXP_OPEN with SSH_FXP_STATUS containing FX_OK and a later sftp_packet_require() call returns a specific error such as LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED, causing the same response buffer to be freed twice.
The libssh2 project addressed the flaw in commit 5e4776146552d898b9c0e1b313cd093fa8dc92d0, merged through pull request #2180, by nullifying the pointer after it is freed in the SFTP code. The fix, which also resolves advisory GHSA-px3w-7g75-hg7w, credits VladimirEliTokarev for reporting the issue. Security writeups warn that on glibc-based systems the bug can produce tcache-dup style heap corruption, potentially enabling overlapping allocations and function pointer overwrites, and users are advised to update libssh2 or apply the patch and recompile.
Why it matters
Impact assessment
Affects organizations and software vendors that use libssh2-based SSH/SFTP client functionality, especially applications that connect to untrusted, third-party, or internet-exposed SSH servers. The immediate risk is client-side memory corruption, crashes, and potential code execution; exposure is broader than a single application because libssh2 is widely embedded and may be statically bundled.
This story centers on CVE-2026-66032, but the referenced disclosures indicate four high-severity libssh2 flaws affecting versions through 1.11.1. Exploitation requires a malicious server or man-in-the-middle position during SSH/SFTP interactions, making the risk most acute for automated file transfer clients, backup tools, integration middleware, developer tooling, and enterprise applications that initiate outbound SSH/SFTP sessions.
Supporting facts
- Affected product: libssh2 through version 1.11.1.
- Primary issue: CVE-2026-66032, high-severity double free in
sftp_open(). - Additional disclosed issues in the same timeframe: CVE-2026-66033, CVE-2026-66034, CVE-2026-66035.
- Affected population: SSH/SFTP client applications using libssh2, including software that statically bundles the library.
- Trigger model: malicious SSH server responses to a connecting client.
- Business impact: application crashes, failed file transfers, service instability, and possible client-side code execution from heap corruption.
- Scope: potentially widespread due to libssh2 reuse across products, but exploitation is targeted to clients that connect to attacker-controlled or compromised servers.
- Known exploitation: no in-the-wild exploitation was cited in the references; SSVC data for CVE-2026-66032 lists exploitation as none.
- Severity: CVE-2026-66032 scored CVSS 3.1 8.8 and CVSS 4.0 8.7, both High.


