CVE-2023-22742Libgit2
Medium 5.9 No auth needed
Follow: this CVE · Libgit2 · Libgit2 We alert you by email or Slack (account required).
- Priority
- 50
- CVSS 3.1
- 5.9
- EPSS
- 0.5% probability of exploitation in 30 days · percentile 33
- Auth required
- No
- Published
- Jan 20, 2023
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-347
- SSVC (CISA)
- Exploitation: none · Automatable: no · Technical impact: partial
- Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
What happens
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.
What to do
- Apply the vendor's security update for Libgit2.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| crates.io | git2 |
< 0.16.1 |
0.16.1 |
cargo update -p git2 --precise 0.16.1 |
| crates.io | libgit2-sys |
≥ 0.14.0 < 0.14.2 |
0.14.2 |
cargo update -p libgit2-sys --precise 0.14.2 |
| crates.io | libgit2-sys |
< 0.13.5 |
0.13.5 |
cargo update -p libgit2-sys --precise 0.13.5 |
| crates.io | libgit2-sys |
≥ 0.0.0-0 < 0.13.5 |
0.13.5 |
cargo update -p libgit2-sys --precise 0.13.5 |
| crates.io | libgit2-sys |
≥ 0.14.0 < 0.14.2 |
0.14.2 |
cargo update -p libgit2-sys --precise 0.14.2 |
Per OSV / GitHub Advisories (GHSA-m4ch-rfv5-x5g3, RUSTSEC-2023-0003). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| libgit2 | libgit2 | < 1.4.5 |
| libgit2 | libgit2 | 1.5.0 |
Official sources
References
Links published by the sources. Open them with care.
- www.openwall.com
- github.com Patch Third Party Advisory
- github.com Patch Third Party Advisory
- github.com Release Notes Third Party Advisory
- github.com Release Notes Third Party Advisory
- github.com Third Party Advisory
- www.libssh2.org Third Party Advisory