CVEfocus › CVE database › CVE-2023-22742

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

CVSS 5.3 MediumEPSS 0.5% (higher than 33% of CVEs)Published 2023-01-20Updated 2025-03-10Assigner: GitHub_M

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.

CWE-347

What to do

Fixed builds are available from Alpine, Debian, Ubuntu, crates.io: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

8Fixed
2Fix pending
1Will not fix
21Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04libgit2Not affected
vulnerable_code_not_present
Ubuntu 25.10libgit2Not affected
vulnerable_code_not_present
Ubuntu 24.04libgit2Not affected
vulnerable_code_not_present
Ubuntu 22.04libgit2Fixed1.1.0+dfsg.1-4.1ubuntu0.1UBUNTU-CVE-2023-22742
Ubuntu 20.04libgit2Fixed0.28.4+dfsg.1-2ubuntu0.1UBUNTU-CVE-2023-22742
Ubuntu 18.04libgit2Fix pending0.26.0+dfsg.1-1.1ubuntu0.2+esm1 (Ubuntu Pro)UBUNTU-CVE-2023-22742
Ubuntu 16.04libgit2Fix pending0.24.1-2ubuntu0.2+esm2 (Ubuntu Pro)UBUNTU-CVE-2023-22742
Debian 14libgit2Fixed1.5.1+ds-1DEBIAN-CVE-2023-22742
Debian 13libgit2Fixed1.5.1+ds-1DEBIAN-CVE-2023-22742
Debian 12libgit2Fixed1.5.1+ds-1DEBIAN-CVE-2023-22742
Red Hat Enterprise Linux 9cargoNot affected
Red Hat Enterprise Linux 9clippyNot affected
Red Hat Enterprise Linux 9rustNot affected
Red Hat Enterprise Linux 9rust-analysisNot affected
Red Hat Enterprise Linux 9rust-analyzerNot affected
Red Hat Enterprise Linux 9rust-debugger-commonNot affected
Red Hat Enterprise Linux 9rust-docNot affected
Red Hat Enterprise Linux 9rust-gdbNot affected
Red Hat Enterprise Linux 9rust-lldbNot affected
Red Hat Enterprise Linux 9rust-srcNot affected
Red Hat Enterprise Linux 9rust-std-staticNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-unknown-unknownNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-wasiNot affected
Red Hat Enterprise Linux 9rust-std-static-wasm32-wasip1Not affected
Red Hat Enterprise Linux 9rust-toolsetNot affected
Red Hat Enterprise Linux 9rustfmtNot affected
Red Hat Enterprise Linux 8libgit2Not affected
Red Hat Enterprise Linux 8libgit2-develNot affected
Red Hat Enterprise Linux 7libgit2Will not fix
Out of support scope
Alpine Linux 3.17libgit2Fixed1.5.1-r0ALPINE-CVE-2023-22742
crates.io librarygit2Fixed0.16.1GHSA-m4ch-rfv5-x5g3
crates.io librarylibgit2-sysFixed0.14.2RUSTSEC-2023-0003

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.