Document and validate the minimum libssh2 version for 32-bit cargo builds
Problem
Cargo's git fetch path uses git2/libgit2, which links libssh2. On 32-bit targets, a build can link a system libssh2 (for example with LIBSSH2_SYS_USE_PKG_CONFIG=1) that is older than the versions containing fixes for known libssh2 issues:
- CVE-2019-3855: fixed in libssh2 1.8.1;
- CVE-2019-17498: fixed in libssh2 1.10.0.
The linked native version is not visible from Cargo:
cargo --version --verboseprints libgit2, libcurl, ssl, and os, but not libssh2 (see the current output in #17587).- Cargo.lock only shows the libssh2-sys crate version, not the native library.
cargo metadata/SBOM do not include non-Rust dependencies; #16565 explicitly says non-Rust dependencies are out of scope for SBOM.
Use case: distributions and CI images that build Cargo for 32-bit targets against system libraries need to know which libssh2 they ship. Today they must inspect the binary externally, and Cargo's own output cannot answer the question. The minimum supported libssh2 version is also not documented, so old system libraries can persist silently.
This is not a vulnerability report and contains no exploit details. The default 64-bit vendored build is not affected; this is about 32-bit/system-libssh2 builds.
Proposed Solution
-
Document the minimum supported libssh2 version for Cargo's git fetch (1.8.1 for CVE-2019-3855; 1.10.0 for CVE-2019-17498), including the 32-bit/system-libssh2 caveat.
-
Emit a build-time warning when a system libssh2 below the minimum is detected. libssh2-sys/build.rs already receives the version from pkg_config::find_library but discards it; it could emit
cargo:warning=...for a system library below the minimum. -
If acceptable, expose the linked libssh2 version in
cargo --version --verbose, next to libgit2/libcurl/ssl. This was requested in #6275 and deliberately omitted in #9968; the 32-bit system-libssh2 case is a new reason to revisit it. The plumbing could be a direct libssh2-sys dependency forlibssh2_version(), or metadata re-exported by libgit2-sys, so Cargo can print it without guessing from Cargo.lock. -
Optional: add CI coverage for a 32-bit build with system libssh2, so this configuration does not silently regress.
Notes
-
Environment: cargo 0.100.0 (commit 5f94df4789f005f9a352888e8355ffc645b7ed0e), i686-unknown-linux-gnu, libgit2 1.9.7, system libssh2 1.8.0/1.9.0. The default 64-bit vendored stack (libssh2 1.11.1) is not affected.
-
Related: #6275 (closed; C library versions in --version --verbose, including libssh2), #9968 (closed; added libgit2/curl/ssl/os, omitted libssh2), #6161 (open; more information in --version --verbose), #17587 (current output example, no libssh2), #16565 (SBOM; non-Rust dependencies out of scope), #17227 (CLI git fetching; long-term mitigation).
-
I reviewed open and closed issues first. The closest are #6275/#6161; this request is specifically about the 32-bit/system-libssh2 minimum and build validation, not a request to add every C library to the version list. If #6161 is the preferred home for the version-output part, please close this as a duplicate and I will continue there.
hey , i'd like to work on this issue .