CVE-2026-58051 libssh2 - Free of Uninitialized Pointer in publickey List Cleanup

High 8.3 Published Updated

A malicious SSH server can trigger a use-after-free in libssh2 clients via malformed publickey responses, potentially leading to code execution or crashes.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-58051?

CVE-2026-58051 is a high-severity use after free vulnerability in libssh2, published on 28 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

libssh2 through 1.11.1 grows its publickey list with SSH2_REALLOC but does not zero-initialize new entries before parsing populates them, so a parse failure reaching the cleanup path leaves libssh2_publickey_list_free operating on an uninitialized entry. A malicious SSH server offering the publickey subsystem can use a malformed response to make cleanup free an uninitialized, attacker-influenceable attrs pointer in a connecting libssh2 client.

Weakness: CWE-908

Which versions are affected by CVE-2026-58051?

It affects 1 product.

Linux distribution packages (3)
libssh2 Red Hat:hummingbird:1All versions0:1.11.1-10.1.hum1
libssh2-devel Red Hat:hummingbird:1All versions0:1.11.1-10.1.hum1
libssh2-docs Red Hat:hummingbird:1All versions0:1.11.1-10.1.hum1

Products include Libssh2 Libssh2.

How do I fix CVE-2026-58051?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2026-58051 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-58051 exists.

Sources

Also known as ALPINE-CVE-2026-58051, AZL-91385, AZL-97395, AZL-97437, BELL-CVE-2026-58051, DEBIAN-CVE-2026-58051 and 5 more.

Is CVE-2026-58051 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free