# CVE-2023-22742: libgit2 fails to verify SSH keys by default

- Severity: Medium 5.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.63%, higher than 51% of CVEs (2026-12-01)
- Published: 2023-01-20T12:00:00.000Z
- Modified: 2026-10-14T17:07:22.000Z
- Also known as: GHSA-m4ch-rfv5-x5g3, GHSA-8643-3wh5-rmjq, RUSTSEC-2023-0003
- Weaknesses: CWE-347
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

libgit2 is a cross-platform, linkable library implementation of Git. When using an SSH remote with the optional libssh2 backend, libgit2 does not perform certificate checking by default. Prior versions of libgit2 require the caller to set the `certificate_check` field of libgit2's `git_remote_callbacks` structure - if a certificate check callback is not set, libgit2 does not perform any certificate checking. This means that by default - without configuring a certificate check callback, clients will not perform validation on the server SSH keys and may be subject to a man-in-the-middle attack. Users are encouraged to upgrade to v1.4.5 or v1.5.1. Users unable to upgrade should ensure that all relevant certificates are manually checked.

(As written by CVE List.)

## Affected

- libgit2 libgit2: < 1.4.5; = 1.5.0; before 1.4.5; 1.5.0
- libgit2-sys (crates.io): from 0.14.0 before 0.14.2; before 0.13.5; from 0.0.0-0 before 0.13.5
- git2 (crates.io): before 0.16.1

## Every score

- GitHub_M: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N`
- GitHub: CVSS:3.1 6.8 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N`
- NVD: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`

## References

- <https://github.com/libgit2/libgit2/security/advisories/GHSA-8643-3wh5-rmjq> (third-party-advisory, web)
- <https://github.com/libgit2/libgit2/commit/42e5db98b963ae503229c63e44e06e439df50e56> (patch, third-party-advisory)
- <https://github.com/libgit2/libgit2/commit/cd6f679af401eda1f172402006ef8265f8bd58ea> (patch, third-party-advisory)
- <https://github.com/libgit2/libgit2/releases/tag/v1.4.5> (release-notes, third-party-advisory)
- <https://github.com/libgit2/libgit2/releases/tag/v1.5.1> (release-notes, third-party-advisory)
- <https://www.libssh2.org> (third-party-advisory)
- <http://www.openwall.com/lists/oss-security/2023/11/06/5>
- <https://github.com/rust-lang/git2-rs/security/advisories/GHSA-m4ch-rfv5-x5g3> (web)
- <https://nvd.nist.gov/vuln/detail/CVE-2023-22742> (advisory)
- <https://github.com/rust-lang/git2-rs/commit/87934f87d36753ed702792ec063be7246444a8e1> (web)
- <https://github.com/rust-lang/git2-rs> (package)
- <https://rustsec.org/advisories/RUSTSEC-2023-0003.html> (advisory, web)
- <https://crates.io/crates/libgit2-sys> (package)

## Sources

- CVE List: [CVE-2023-22742](https://www.cve.org/CVERecord?id=CVE-2023-22742), CVE Terms of Use, modified 2025-03-10
- GitHub Advisory Database: [GHSA-m4ch-rfv5-x5g3](https://github.com/advisories/GHSA-m4ch-rfv5-x5g3), CC-BY-4.0, modified 2026-10-14
- RustSec Advisory Database: [RUSTSEC-2023-0003](https://rustsec.org/advisories/RUSTSEC-2023-0003.html), CC0-1.0, modified 2026-10-12
- NVD: [CVE-2023-22742](https://nvd.nist.gov/vuln/detail/CVE-2023-22742), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2023-22742 · Whole record: https://cve.day/CVE-2023-22742.json · Rebuilt by cve.day 2026-11-25T22:58:21.691Z
