Flaw in popular SSH library libssh2 lets rogue servers attack clients

A newly disclosed flaw in libssh2, a small open-source library that thousands of applications and devices use to make SSH connections, can let a malicious server corrupt the memory of any program that connects to it. Because libssh2 is quietly built into widely used tools, the bug's reach is far larger than its low profile suggests. It was disclosed on June 28, 2026 and is tracked as CVE-2026-58050.

libssh2 is the plumbing that lets software speak SSH, the standard protocol for secure remote connections and file transfers. It is embedded in common components, from the data-transfer tool curl to the Git library libgit2 and PHP's SSH extension, as well as countless network appliances and embedded devices. The flaw affects every version up to and including 1.11.1 and carries a high severity rating (7.0 on the older CVSS scale, 8.3 on the newer one).

How it works

The weakness lives in the part of libssh2 that handles public-key authentication. When a client connects, the server sends back a list of attributes, and libssh2 reads an attacker-controlled 32-bit count of how many attributes to expect. It then multiplies that number by the size of each attribute record to decide how much memory to reserve, without checking whether the result makes sense. On 32-bit systems that multiplication can overflow and wrap around to a small number (an integer overflow), so libssh2 reserves a buffer that is far too small. The code then keeps writing attributes into it, spilling past the end, a classic heap buffer overflow.

Who is at risk

The important twist is the direction of the attack: it is the SSH client that gets hit, not the server. A malicious or compromised SSH server can trigger the overflow in any client that connects to it using a vulnerable copy of libssh2. At minimum that crashes the program; at worst it could let the server run its own code on the client. The 32-bit condition makes embedded and IoT gear a particular concern, since those devices often run 32-bit processors and rarely get their SSH libraries updated. There is no public report of exploitation in the wild yet, but the technical details are now out, which shortens the runway for defenders.

What you should do

Update libssh2 to the patched release the maintainers shipped with the advisory, and update any software that bundles it as those projects issue new builds. Developers should check whether their dependencies pull in libssh2, directly or through curl, libgit2, or language bindings, and rebuild against the fix. Until everything is patched, the practical mitigation is to connect only to SSH servers you trust, since the attack requires the victim to initiate a connection to a hostile server. It is another reminder that the most dangerous bugs often hide in the small, shared open-source components everyone depends on but few track, the same lesson behind recent open-source supply-chain attacks and flaws in core runtimes like Node.js. Full technical detail is in the original VulnCheck advisory.

This briefing is provided by IntelFusions for informational and defensive purposes only. It is based on sources assessed to be reliable at the time of writing, and analytic judgments carry the confidence levels indicated. Indicators of compromise are defanged; re-arm them only in controlled environments. IntelFusions is not affiliated with the organizations named and makes no warranty as to completeness or accuracy.

Read the full analysis on IntelFusions