Skip to content
OpenAdvisories
Medium · 5.3 CVE-2023-22742 EUVD-2023-26860GHSA-8643-3wh5-rmjqGHSA-m4ch-rfv5-x5g3RUSTSEC-2023-0003

libgit2 fails to verify SSH keys by default

Published Jan 20, 2023 · Updated Mar 10, 2025 · 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.

Affected products

VendorProductAffectedFixed
libgit2 libgit2 < 1.4.5, = 1.5.0 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 libgit2 1.5.1+ds-1 —
Debian 13 libgit2 1.5.1+ds-1 —
Debian 12 libgit2 1.5.1+ds-1 —
Debian 10 libgit2 0.27.7+dfsg.1-0.2+deb10u1 DLA-3340-1
ReleasePackageFixed inAdvisory
Ubuntu 22.04 LTS libgit2 1.1.0+dfsg.1-4.1ubuntu0.1 USN-6678-1
Ubuntu 20.04 LTS libgit2 0.28.4+dfsg.1-2ubuntu0.1 USN-6678-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 18.04 LTS libgit2 0.26.0+dfsg.1-1.1ubuntu0.2+esm1 USN-6678-1
Ubuntu Pro 16.04 LTS libgit2 0.24.1-2ubuntu0.2+esm2 USN-6678-1
ReleasePackageFixed inAdvisory
SLES 15 SP4 libgit2 1.3.0-150400.3.6.1 SUSE-SU-2023:1788-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLE Real Time 15 SP3 libgit2 0.28.4-150200.3.6.1 SUSE-SU-2023:1909-1
SUSE Manager Server Module 4.3 libgit2 0.28.4-150200.3.6.1 SUSE-SU-2023:1909-1
SUSE Manager Server Module 4.2 libgit2 0.28.4-150200.3.6.1 SUSE-SU-2023:1909-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed libgit2 1.5.1-1.1 openSUSE-SU-2024:12632-1
openSUSE Leap 15.4 libgit2 0.26.8-150000.3.18.1 SUSE-SU-2023:1909-1, SUSE-SU-2023:1788-1, SUSE-SU-2023:1570-1
ReleasePackageFixed inAdvisory
Alpine v3.17 libgit2 1.5.1-r0 —

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 2 (CBL-Mariner) rust 1.68.0-1 —

Affected packages

EcosystemPackageAffectedFixedRecord
crates.io git2 < 0.16.1 0.16.1 GHSA-m4ch-rfv5-x5g3
crates.io libgit2-sys >= 0.14.0, < 0.14.2 0.14.2 GHSA-m4ch-rfv5-x5g3
crates.io libgit2-sys < 0.13.5 0.13.5 GHSA-m4ch-rfv5-x5g3
crates.io libgit2-sys >= 0.0.0-0, < 0.13.5 · >= 0.14.0, < 0.14.2 0.13.5, 0.14.2 RUSTSEC-2023-0003

Advisories 8

References