CVE-2026-66035
High · 7.5CVSS
7.5
EPSS
0.5%
Published
Jul 24, 2026
CISA due date
—
Cloudanix analysis
A malicious SSH server could crash or potentially take over software that uses a vulnerable SSH library when that software connects to it.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- High
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
CVE-2026-66035 is a pre-authentication heap buffer overflow in libssh2's SSH transport parsing during Encrypt-then-MAC cipher negotiation. When a libssh2-based client connects to a malicious SSH server, the server can send a malformed packet whose packet_length is smaller than the negotiated cipher block size. In the ETM code path in fullpacket() in src/transport.c, libssh2 allocates a buffer based on the small packet_length but copies blocksize minus one bytes into it, overflowing heap memory. The described impact is strongest on 32-bit glibc, where attacker-controlled bytes may corrupt adjacent heap chunk metadata, potentially enabling tcache bin confusion, overlapping allocations, and overwrite of control data such as function pointers during the SSH handshake before authentication. Practical exploitation is high-complexity and client-initiated: the vulnerable client must connect to an attacker-controlled or compromised SSH server.
Why it matters to the business
Systems and applications that use vulnerable libssh2 versions to connect to SSH, SFTP, Git-over-SSH, or automation endpoints could be crashed or potentially compromised by a malicious server before login occurs. The highest-risk scenarios are build systems, deployment tools, backup jobs, file-transfer workflows, package retrieval, and administrative automation that connect to third-party, user-supplied, or otherwise untrusted SSH servers. Although the issue is not currently listed in CISA KEV, has no reported ransomware association, and has a low EPSS score, successful exploitation could lead to loss of integrity and confidentiality on affected client systems, particularly where 32-bit glibc builds or exposed automation clients are still in use.
How an attack unfolds
An attacker first positions or controls an SSH server that a vulnerable libssh2-based client will connect to, such as a malicious SFTP endpoint, compromised Git/SSH service, or attacker-supplied host in an automation workflow. During the SSH handshake, before authentication, the malicious server negotiates an Encrypt-then-MAC cipher/MAC combination. It then sends a specially malformed SSH packet with a packet_length smaller than the cipher block size. The vulnerable client allocates too small a buffer but copies more bytes than allocated, corrupting heap memory. In less reliable cases this causes the client process to abort or crash. In more favorable memory layouts, especially on 32-bit glibc, the corrupted heap metadata may be shaped into overlapping allocations and eventual overwrite of sensitive process data or function pointers, potentially resulting in code execution in the context of the client process.
How to fix it
Upgrade affected libssh2 packages to a fixed release. For Red Hat libssh2-main, update to libssh2-main 1.11.1-10.3.hum1 or later as provided by RHSA-2026:46955. For source-built or bundled libssh2, apply the upstream fix corresponding to commit 42e33d8 or consume a vendor release that includes that patch. Because libssh2 is often embedded or statically linked, do not rely only on the operating system package version: inspect application bundles, containers, appliances, language bindings, and vendor-supplied agents that may carry their own copy. If immediate patching is not possible, reduce exposure by preventing vulnerable clients from connecting to untrusted SSH/SFTP/Git servers, allowlisting approved SSH destinations, disabling workflows that accept user-supplied SSH hosts, and prioritizing replacement of 32-bit glibc deployments using vulnerable libssh2.
How to confirm the fix worked
Confirm remediation by verifying that every installed, bundled, or statically linked libssh2 instance is at a fixed vendor build or includes the upstream patch. On package-managed Linux systems, query package versions and confirm Red Hat systems are at libssh2-main 1.11.1-10.3.hum1 or later where applicable. For containers and appliances, rescan images and firmware/software bills of materials for libssh2 through 1.11.1 without the fix. For source builds, confirm the patch corresponding to commit 42e33d8 is present in src/transport.c. Where feasible, review dynamic linking with tools such as ldd or equivalent runtime dependency inspection to identify applications loading vulnerable libssh2 libraries. Exposure is reduced when vulnerable clients cannot connect to untrusted SSH servers and when ETM malformed packet handling no longer produces crashes under controlled validation testing.
Typical attack path
- Identify software, agents, scripts, or appliances that use libssh2 as an SSH/SFTP client.
- Create or compromise an SSH server that vulnerable clients are likely to connect to.
- Ensure the connection path reaches the attacker-controlled SSH service and that Encrypt-then-MAC negotiation is available.
- During the pre-authentication SSH handshake, send a malformed packet whose packet_length is smaller than the negotiated cipher block size.
- Trigger the vulnerable ETM packet handling path in libssh2, causing a heap buffer overflow in the connecting client.
- Use the resulting memory corruption to crash the process or, where feasible, manipulate heap state toward code execution in the client process context.
How to detect it
Look for evidence that libssh2-based clients connected to suspicious or newly observed SSH servers and then crashed, aborted, or behaved abnormally during the pre-authentication handshake. Useful sources include application logs for SFTP/Git/SSH automation, CI/CD job logs, backup and file-transfer logs, endpoint process crash logs, Linux journal/syslog, core dump metadata, EDR telemetry, and outbound network connection logs for TCP/22 or other SSH service ports. Network detection should focus on vulnerable clients initiating SSH sessions where Encrypt-then-MAC algorithms are negotiated and the server sends malformed early packets with a packet length smaller than the negotiated cipher block size; this generally requires packet capture or protocol-aware SSH telemetry. Host-based hunting should correlate outbound SSH connections to untrusted destinations with glibc heap corruption messages, segmentation faults, core dumps, or restarts of applications known to use libssh2. If named threat intelligence is unavailable, treat repeated crashes tied to the same remote SSH host, newly registered infrastructure, or user-supplied SSH endpoints as suspicious.
- hmac-sha2-256-etm@openssh.com
- hmac-sha2-512-etm@openssh.com
- hmac-sha1-etm@openssh.com
- umac-64-etm@openssh.com
- umac-128-etm@openssh.com
- malloc(): invalid size
- malloc(): corrupted top size
- malloc(): memory corruption
- free(): invalid size
- corrupted size vs. prev_size
- double free or corruption
- Fatal glibc error: malloc assertion failure
- Segmentation fault
- core dumped
- libssh2
- SSH packet_length smaller than cipher block size during Encrypt-then-MAC negotiation
What your security team should do
- Inventory all software that uses libssh2, including SSH/SFTP clients, Git tooling, backup products, CI/CD agents, file-transfer automation, containers, and vendor appliances.
- Prioritize patching externally influenced or automation-driven clients that connect to third-party, user-provided, or internet-hosted SSH services.
- Update Red Hat libssh2-main to 1.11.1-10.3.hum1 or later, and ensure bundled or source-built copies include upstream commit 42e33d8 or a vendor equivalent.
- Hunt for recent crashes or abnormal terminations of libssh2-based client applications during outbound SSH/SFTP/Git-over-SSH connections, especially shortly after connecting to unfamiliar hosts.
- Restrict outbound SSH from automation systems to allowlisted destinations until patching is complete.
- Identify and prioritize any remaining 32-bit glibc deployments using libssh2, as the described heap metadata corruption is particularly relevant there.
- Monitor vendor advisories for applications that statically link or bundle libssh2, because operating system package updates may not remediate embedded copies.
- Because the vulnerability is not currently KEV-listed and EPSS is low, treat it as priority for exposed automation and untrusted-server workflows rather than a universal emergency patch, unless local exposure is high.
The record
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.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|
Related vulnerabilities
- CVE-2026-120775 Tanium addressed a heap-based buffer overflow vulnerability in Deploy. CWE-122
- CVE-2026-121517 A vulnerability was detected in IrfanView 4.76.0.0 on Win64. CWE-122
- CVE-2026-121247 Buffer overflow in Dawn in Google Chrome on on Android prior to 157.0.8103.38 allowed a… CWE-122
- CVE-2026-121180 Buffer overflow in Media in Google Chrome prior to 157.0.8103.38 allowed a remote… CWE-122
- CVE-2026-121156 Buffer overflow in Dawn in Google Chrome prior to 157.0.8103.38 allowed a remote attacker… CWE-122
- CVE-2026-121113 Buffer overflow in PDFium in Google Chrome prior to 157.0.8103.38 allowed a remote… CWE-122
- CVE-2026-121086 Buffer overflow in Skia in Google Chrome prior to 157.0.8103.38 allowed a remote attacker… CWE-122
- CVE-2026-121047 Buffer overflow in Media in Google Chrome prior to 157.0.8103.38 allowed a remote… CWE-122