Reach libssh2 · 8 builds in 4 of 4 releases
full reviewcross-check✓ a member decided
Description · NVD
libssh2 through 1.11.1 reads an attacker-controlled 32-bit attribute count from a publickey-subsystem response and uses it in the allocation num_attrs * sizeof(libssh2_publickey_attribute) without bounds checking, so on 32-bit platforms the multiplication overflows to an undersized buffer. A malicious SSH server can then drive the attribute-parsing loop to write past the allocation, causing a heap buffer overflow 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
- Low
- 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:L/VI:L/VA:H/SC:N/SI:N/SA:N
Fable 5.1 · high confidence · 2026-11-05
The unbounded num_attrs * sizeof(libssh2_publickey_attribute) allocation described by the CVE is present verbatim in the built source (output/build/libssh2-1.11.1/src/publickey.c:1123-1127) and none of the 10 Buildroot patches touch it (0009 fixes a different bug, CVE-2026-66034, in the version-1 comment_len branch at line ~991).
However, the only callers of this function are libssh2_publickey_init()/libssh2_publickey_list_fetch(), and no consumer in the image uses that API: libcurl's SCP/SFTP backend (libcurl-8.22.0/lib/vssh/libssh2.c) and nmap's NSE binding (nmap-7.95/nse_libssh2.cc) use only session/channel/userauth functions, and these are the only two packages that link libssh2 (config.log search). No finit service, YANG node, or CLI command drives an outbound libssh2 publickey-subsystem connection, so reaching the code requires a root shell and a custom program linked against /usr/lib/libssh2.so.1.
Additionally, this is an x86_64 build (BR2_ARCH_IS_64=y) where num_attrs is unsigned long (64-bit), so the 32-bit multiplication overflow the CVE depends on cannot occur; the worst case is a failed oversized malloc followed by a clean error return.
Evidence 12
num_attrs read via _libssh2_ntohu32 from server data, then LIBSSH2_ALLOC(num_attrs * sizeof(libssh2_publickey_attribute)) with no bounds check — the vulnerable code is present unmodified
output/build/libssh2-1.11.1/src/publickey.c:1114,1123-1127
Only publickey.c patch applied; it adds a comment_len bounds check for CVE-2026-66034 (version-1 branch, line ~991), not the num_attrs allocation
buildroot/package/libssh2/0009-publickey-fix-potential-OOB-read.patch
10 patches applied (0001-0010); none references CVE-2026-58050 or the num_attrs multiplication
output/build/libssh2-1.11.1/.applied_patches_list
num_attrs is `unsigned long` (64-bit on x86_64), so uint32 * 40 cannot overflow on this target
output/build/libssh2-1.11.1/include/libssh2_publickey.h:70
BR2_ARCH_IS_64=y, BR2_ARCH="x86_64"; BR2_PACKAGE_LIBSSH2=y with OpenSSL backend
output/.config:24,52,2188-2190
libssh2 explicitly selected in the Infix defconfig (not merely a dependency)
configs/x86_64_defconfig:52-53
publickey.c is compiled into libssh2.so (no option to exclude it)
output/build/libssh2-1.11.1/src/publickey.lo
libcurl and nmap are the only packages that link libssh2 (confirmed by config.log grep across output/build)
buildroot/package/libcurl/libcurl.mk:111-113; buildroot/package/nmap/nmap.mk:31-34
curl uses only libssh2_userauth_publickey_* (authentication), never libssh2_publickey_init/list_fetch
output/build/libcurl-8.22.0/lib/vssh/libssh2.c (grep 'publickey')
nmap NSE binding wraps session/channel/userauth functions only; no publickey-subsystem calls
output/build/nmap-7.95/nse_libssh2.cc (libssh2_ symbol list)
No caller anywhere in the built packages; the function is dead code in the image
rg 'libssh2_publickey_init|libssh2_publickey_list_fetch' output/build (excluding libssh2 and nmap's unused bundled copy)
Only 'sftp' reference in confd is mDNS advertisement of the device's own SSH server; no YANG/CLI feature drives an outbound libssh2 publickey-subsystem session
src/confd/src/services.c:108
Version and patches
NVD range: libssh2 through 1.11.1 (no fixed release at time of review; fix is in upstream master publickey.c). This build is 1.11.1 with 10 Buildroot patches; none fix CVE-2026-58050 and libssh2.mk has no IGNORE_CVES entry for it. The vulnerable hunk at src/publickey.c:1123-1127 is unmodified. CPE/product mapping is correct.
Recommendation
Document as not applicable for the x86_64 image (no caller of the publickey subsystem in the image; 64-bit arithmetic prevents the overflow). Consider adding a Buildroot backport of the upstream num_attrs bounds check (or LIBSSH2_IGNORE_CVES with justification) when convenient, mainly so 32-bit targets (arm_defconfig also selects libssh2) are covered. No urgent action.
Open questions
The upstream fix commit hash could not be read from the tree (only the master publickey.c URL is referenced); the exact backport hunk should be taken from upstream when adding a patch. The 32-bit arm_defconfig builds were not reviewed here, though the same no-caller analysis is expected to apply.
Members of Kernel Kit decide. Sign in if you are one.