Reach libssh2 · 8 builds in 4 of 4 releases
full reviewcross-check✓ a member decided
Description · NVD
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.
Published 2026-06-28NVD
CVSS 4.0Network · no privileges · no user interaction
How it is reached
- Attack vector
- Network
- Attack complexity
- High
- Attack requirements
- None
- Privileges required
- None
- User interaction
- None
What it costs
- Confidentiality
- None
- Integrity
- Low
- Availability
- High
What it costs other systems
- Confidentiality
- None
- Integrity
- None
- Availability
- None
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N
Fable 5.1 · high confidence · 2026-11-05
The vulnerable code is present and unfixed: output/build/libssh2-1.11.1/src/publickey.c grows the key list with LIBSSH2_REALLOC without zeroing (lines 960-975) and err_exit (1213-1220) calls libssh2_publickey_list_free on it; none of the 10 Buildroot patches address this (0009 is CVE-2026-66034, a different bounds check).
libssh2 is explicitly selected (configs/x86_64_defconfig:52) and linked by libcurl and nmap, but neither calls libssh2_publickey_init/libssh2_publickey_list_fetch, and no code anywhere in the tree does; the CLI copy command uses OpenSSH scp(1) for scp://, sftp:// URIs.
Reaching the bug requires a root shell plus a custom libssh2-linked program using the publickey subsystem against a malicious server, so it is not reachable from the network or via any management interface in the shipped product.
Evidence 10
LIBSSH2_REALLOC grows `list` by 8 entries with no memset; new entries (incl. list[0] on first growth) are uninitialized
output/build/libssh2-1.11.1/src/publickey.c:960-975
Multiple `goto err_exit` parse-failure exits fire before list[keys].attrs/packet are assigned
output/build/libssh2-1.11.1/src/publickey.c:979-1121
err_exit calls libssh2_publickey_list_free(), which loops on p->packet and frees p->attrs: vulnerable pattern present and unfixed
output/build/libssh2-1.11.1/src/publickey.c:1213-1220, 1240-1243
Only publickey.c patch applied; it is CVE-2026-66034 (comment_len bounds check), not a zero-initialisation fix. No other patch touches publickey.c
buildroot/package/libssh2/0009-publickey-fix-potential-OOB-read.patch
libssh2 explicitly selected with OpenSSL backend; output/build/libssh2-1.11.1/.stamp_target_installed present
configs/x86_64_defconfig:52-53, output/.config:2188-2190
libcurl built with --with-libssh2 (USE_LIBSSH2 1); libcurl Makefile LIBCURL_PC_LIBS_PRIVATE includes -lssh2
buildroot/package/libcurl/libcurl.mk:111-113; output/build/libcurl-*/lib/curl_config.h:835
Complete libssh2_* call set is session/userauth/agent/knownhost/scp/sftp/channel; no libssh2_publickey_init or libssh2_publickey_list_fetch
output/build/libcurl-*/lib/vssh/libssh2.c
nmap (selected, .config:3411) links system libssh2; NSE binding exposes only session/channel/userauth functions, no publickey-subsystem API
buildroot/package/nmap/nmap.mk:31-34; output/build/nmap-7.95/nse_libssh2.cc
Only hits are libssh2 itself and nmap's unused bundled libssh2 copy; no consumer in the tree
grep of output/build and src for libssh2_publickey_init|libssh2_publickey_list_fetch
CLI `copy` handles scp:// and sftp:// URIs via OpenSSH scp(1), not libcurl/libssh2
src/bin/copy.c:182-206, 575, 608
Version and patches
NVD: libssh2 <= 1.11.1 affected. Build is 1.11.1 plus Buildroot patches 0001-0010; none of them fixes this issue (0009 is CVE-2026-66034), libssh2.mk has no IGNORE_CVES for CVE-2026-58051, and the realloc'd entries are still not zero-initialised in the configured source. Upstream fix commit could not be fetched (no network); conclusion rests on reading the code.
Recommendation
Document as not exposed; no urgent action. Backport the upstream fix (zero-initialise realloc'd list entries in libssh2_publickey_list_fetch) as patch 0011 or pick it up at the next libssh2 bump to silence SBOM scanners. Re-evaluate if any future image component uses libssh2's publickey subsystem API.
Open questions
output/target in this artifact cache contains no shared objects, so linkage was verified from build-directory Makefiles (libcurl -lssh2, nmap LIBSSH2_LIBS=-lssh2) rather than the installed binaries. The upstream fix commit and fixed version were not readable from the tree (no network access).
Members of Kernel Kit decide. Sign in if you are one.