Vulnerability MediumRUSTSEC-2023-0003 · libgit2-sys
RUSTSEC-2023-0003: git2 does not verify SSH keys by default
Short answerA security vulnerability in the libgit2-sys crate: git2 does not verify SSH keys by default. GitHub rates it Medium. Fixed in 0.13.5, 0.14.2: update to a fixed version.
| Crate | libgit2-sys |
|---|---|
| Type | Vulnerability (crypto-failure) |
| Affected versions | Before 0.13.5; from 0.14.0 before 0.14.2. |
| Fixed in | 0.13.5, 0.14.2 |
| Severity | Medium (GitHub rating) |
| Published | 2023-01-20 |
| Last changed | 2026-10-12 |
| Also known as | CVE-2023-22742, GHSA-8643-3wh5-rmjq, GHSA-m4ch-rfv5-x5g3 |
What to do
- See which version you have:
cargo tree -i libgit2-sys(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p libgit2-sys. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplelibgit2-sys = "0.14.2") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
The git2 and libgit2-sys crates are Rust wrappers around the [libgit2]() C library. It was discovered that libgit2 1.5.0 and below did not verify SSH host keys when establishing an SSH connection, exposing users of the library to Man-In-the-Middle attacks.
The libgit2 team assigned CVE-2023-22742 to this vulnerability. The following versions of the libgit2-sys Rust crate have been released:
- libgit2-sys 0.14.2, updating the underlying libgit2 C library to version 1.5.1.
- libgit2-sys 0.13.5, updating the underlying libgit2 C library to version 1.4.5.
A new git2 crate version has also been released, 0.16.1. This version only bumps its libgit2-sys dependency to ensure no vulnerable libgit2-sys versions are used, but contains no code changes: if you update the libgit2-sys version there is no need to also update the git2 crate version.
You can learn more about this vulnerability in libgit2's advisory
References
- Package: crates.io/crates/libgit2-sys
- Advisory: rustsec.org/advisories/RUSTSEC-2023-0003.html
- Web: github.com/rust-lang/git2-rs/commit/87934f87d36753ed702792ec063be7246444a8e1
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for libgit2-sys
Up next
Same cratelibgit2-sys: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?