Every CVE Search/ Get API key

CVE-2023-22742

libgit2 fails to verify SSH keys by default

5.3 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
None
Integrity
High
Availability
None

Exploit likelihood

0.61%Down 0.5 points since Jan 21, 2023
90%50%10%1%

What each source reports

CVE List Score used 5.3

libgit2 fails to verify SSH keys by default

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.

Record
CVE-2023-22742
CVSS 3.1
5.3 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
Weakness
CWE-347
Updated
2026-11-02
EUVDEUVD-2023-26860 5.3

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.

Record
EUVD-2023-26860
CVSS 3.1
5.3 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
Updated
2026-11-02
GitHub AdvisoriesGHSA-m4ch-rfv5-x5g3 6.8

git2-rs fails to verify SSH keys by default

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

Record
GHSA-m4ch-rfv5-x5g3
CVSS 3.1
6.8 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
Updated
2026-11-02
NVD 5.3

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.

Record
CVE-2023-22742
CVSS 3.1
5.3 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Weakness
CWE-347
Updated
2026-11-02
OSVALPINE-CVE-2023-22742 5.9

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.

Record
ALPINE-CVE-2023-22742
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-03
OSVAZL-13175 5.9

CVE-2023-22742 affecting package rust for versions less than 1.68.0-1

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.

Record
AZL-13175
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02
Show 13 moreShow less
OSV 5.3

libgit2 fails to verify SSH keys by default

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.

Record
CVE-2023-22742
CVSS 3.1
5.3 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
Weakness
CWE-347
Updated
2026-11-02
OSVDEBIAN-CVE-2023-22742 5.9

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.

Record
DEBIAN-CVE-2023-22742
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02
OSVGHSA-m4ch-rfv5-x5g3 6.8

git2-rs fails to verify SSH keys by default

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

Record
GHSA-m4ch-rfv5-x5g3
CVSS 3.1
6.8 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
Updated
2026-11-02
OSVJLSEC-2025-184 5.9

libgit2 is a cross-platform, linkable library implementation of Git

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.

Record
JLSEC-2025-184
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02
OSVOESA-2023-1957 5.9

libgit2 security update

libgit2 is a portable, pure C implementation of the Git core methods provided as a re-entrant linkable library with a solid API, allowing you to write native speed custom Git applications in any language which supports C bindings.

Security Fix(es):

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.(CVE-2023-22742)

Record
OESA-2023-1957
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02
OSVUBUNTU-CVE-2023-22742 5.3

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.

Record
UBUNTU-CVE-2023-22742
CVSS 3.1
5.3 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N
Updated
2026-11-02
OSVMGASA-2024-0059 No score

Updated libgit2 packages fix security vulnerabilities

When using an SSH remote with the optional libssh2 backend, libgit2 does not perform certificate checking by default. (CVE-2023-22742) Using well-crafted inputs to git_index_add can cause heap corruption that could be leveraged for arbitrary code execution. (CVE-2024-24577)

Record
MGASA-2024-0059
Updated
2026-11-02
OSVopenSUSE-SU-2024:12632-1 No score

libgit2-1.5.1-1.1 on GA media

These are all security issues fixed in the libgit2-1.5.1-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:12632-1
Updated
2026-11-02
OSVRUSTSEC-2023-0003 No score

git2 does not verify SSH keys by default

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

Record
RUSTSEC-2023-0003
Updated
2026-11-02
OSVSUSE-SU-2023:1570-1 No score

Security update for libgit2

This update for libgit2 fixes the following issues:

  • CVE-2023-22742: Fixed SSH keys verification failure (bsc#1207364).
Record
SUSE-SU-2023:1570-1
Updated
2026-11-02
OSVSUSE-SU-2023:1788-1 No score

Security update for libgit2

This update for libgit2 fixes the following issues:

  • CVE-2023-22742: Verify ssh remote host keys (bsc#1207364)
Record
SUSE-SU-2023:1788-1
Updated
2026-11-02
OSVSUSE-SU-2023:1909-1 No score

Security update for libgit2

This update for libgit2 fixes the following issues:

  • CVE-2023-22742: Fixed SSH keys verification failure (bsc#1207364).
Record
SUSE-SU-2023:1909-1
Updated
2026-11-02
OSVUSN-6678-1 No score

libgit2 vulnerabilities

It was discovered that libgit2 mishandled equivalent filenames on NTFS partitions. If a user or automated system were tricked into cloning a specially crafted repository, an attacker could possibly use this issue to execute arbitrary code. This issue only affected Ubuntu 16.04 LTS and Ubuntu 18.04 LTS. (CVE-2020-12278, CVE-2020-12279)

It was discovered that libgit2 did not perform certificate checking by default. An attacker could possibly use this issue to perform a machine-in-the-middle attack. This issue only affected Ubuntu 16.04 LTS, Ubuntu 18.04 LTS, Ubuntu 20.04 LTS, and Ubuntu 22.04 LTS. (CVE-2023-22742)

It was discovered that libgit2 could be made to run into an infinite loop. An attacker could possibly use this issue to cause a denial of service. This issue only affected Ubuntu 23.10. (CVE-2024-24575)

It was discovered that libgit2 did not properly manage memory. An attacker could possibly use this issue to cause a denial of service or execute arbitrary code. (CVE-2024-24577)

Record
USN-6678-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
libgit2-sys
crates.io
0.14.0 up to 0.14.2
0.14.2
libgit2-sys
crates.io
before 0.13.5
0.13.5
git2
crates.io
before 0.16.1
0.16.1
libgit2
Alpine:v3.17
before 1.5.1-r0
1.5.1-r0
rust
Azure Linux:2
before 1.68.0-1
1.68.0-1
libgit2
Debian:12
before 1.5.1+ds-1
1.5.1+ds-1
libgit2
Debian:13
before 1.5.1+ds-1
1.5.1+ds-1
libgit2
Debian:14
before 1.5.1+ds-1
1.5.1+ds-1
libgit2
Debian:10
From an advisory covering 3 CVEs
before 0.27.7+dfsg.1-0.2+deb10u1, plus listed versions
0.27.7+dfsg.1-0.2
0.27.7+dfsg.1-0.2+deb10u1
LibGit2_jll
Julia
before 1.6.1+0
1.6.1+0
Show 24 moreShow less
Affected packages
PackageAffectedFixed
libgit2
Mageia:9
From an advisory covering 2 CVEs
before 1.3.2-1.1.mga9
1.3.2-1.1.mga9
libgit2
openEuler:20.03-LTS-SP1
before 0.27.8-7.oe1
0.27.8-7.oe1
libgit2
openEuler:20.03-LTS-SP3
before 0.27.8-7.oe1
0.27.8-7.oe1
libgit2
openEuler:20.03-LTS-SP4
before 0.27.8-7.oe2003sp4
0.27.8-7.oe2003sp4
libgit2
openEuler:22.03-LTS
before 1.3.2-2.oe2203sp2
1.3.2-2.oe2203sp2
libgit2
openEuler:22.03-LTS-SP1
before 1.3.2-2.oe2203sp1
1.3.2-2.oe2203sp1
libgit2
openEuler:22.03-LTS-SP2
before 1.3.2-2.oe2203sp2
1.3.2-2.oe2203sp2
libgit2-sys
crates.io
0.0.0-0 up to 0.13.5, 0.14.0 up to 0.14.2
0.13.50.14.2
libgit2
openSUSE:Leap 15.4
before 0.26.8-150000.3.18.1
0.26.8-150000.3.18.1
libgit2
SUSE:Linux Enterprise Module for Development Tools 15 SP4
before 1.3.0-150400.3.6.1
1.3.0-150400.3.6.1
libgit2
openSUSE:Leap 15.4
before 1.3.0-150400.3.6.1
1.3.0-150400.3.6.1
libgit2
SUSE:Manager Server Module 4.2
before 0.28.4-150200.3.6.1
0.28.4-150200.3.6.1
libgit2
SUSE:Manager Server Module 4.3
before 0.28.4-150200.3.6.1
0.28.4-150200.3.6.1
libgit2
SUSE:Linux Enterprise Real Time 15 SP3
before 0.28.4-150200.3.6.1
0.28.4-150200.3.6.1
libgit2
openSUSE:Leap 15.4
before 0.28.4-150200.3.6.1
0.28.4-150200.3.6.1
libgit2
Ubuntu:Pro:16.04:LTS
before 0.24.1-2ubuntu0.2+esm2, plus listed versions
0.22.2-20.23.1-10.24.1-20.24.1-2ubuntu0.20.24.1-2ubuntu0.2+esm1
0.24.1-2ubuntu0.2+esm2
libgit2
Ubuntu:Pro:18.04:LTS
before 0.26.0+dfsg.1-1.1ubuntu0.2+esm1, plus listed versions
0.25.1+really0.24.6-10.26.0+dfsg.1-1.10.26.0+dfsg.1-1.1build10.26.0+dfsg.1-1.1ubuntu0.2
0.26.0+dfsg.1-1.1ubuntu0.2+esm1
libgit2
Ubuntu:20.04:LTS
before 0.28.4+dfsg.1-2ubuntu0.1, plus listed versions
0.27.7+dfsg.1-0.2build10.28.3+dfsg.1-10.28.3+dfsg.1-1ubuntu10.28.4+dfsg.1-2
0.28.4+dfsg.1-2ubuntu0.1
libgit2
Ubuntu:22.04:LTS
before 1.1.0+dfsg.1-4.1ubuntu0.1, plus listed versions
1.1.0+dfsg.1-41.1.0+dfsg.1-4.11.1.0+dfsg.1-4.1build1
1.1.0+dfsg.1-4.1ubuntu0.1
libgit2
Ubuntu:Pro:16.04:LTS
From an advisory covering 4 CVEs
before 0.24.1-2ubuntu0.2+esm2, plus listed versions
0.22.2-20.23.1-10.24.1-20.24.1-2ubuntu0.20.24.1-2ubuntu0.2+esm1
0.24.1-2ubuntu0.2+esm2
libgit2
Ubuntu:Pro:18.04:LTS
From an advisory covering 4 CVEs
before 0.26.0+dfsg.1-1.1ubuntu0.2+esm1, plus listed versions
0.25.1+really0.24.6-10.26.0+dfsg.1-1.10.26.0+dfsg.1-1.1build10.26.0+dfsg.1-1.1ubuntu0.2
0.26.0+dfsg.1-1.1ubuntu0.2+esm1
libgit2
Ubuntu:20.04:LTS
From an advisory covering 4 CVEs
before 0.28.4+dfsg.1-2ubuntu0.1, plus listed versions
0.27.7+dfsg.1-0.2build10.28.3+dfsg.1-10.28.3+dfsg.1-1ubuntu10.28.4+dfsg.1-2
0.28.4+dfsg.1-2ubuntu0.1
libgit2
Ubuntu:22.04:LTS
From an advisory covering 4 CVEs
before 1.1.0+dfsg.1-4.1ubuntu0.1, plus listed versions
1.1.0+dfsg.1-41.1.0+dfsg.1-4.11.1.0+dfsg.1-4.1build1
1.1.0+dfsg.1-4.1ubuntu0.1
libgit2
openSUSE:Tumbleweed
before 1.5.1-1.1
1.5.1-1.1

History

History
RecordedChangedSources
affected, facts
affected, aliases, referencesOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2023-22742 is a medium vulnerability (CVSS 5.3) in Libgit2, published January 20, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.61%, the 49th percentile. Fixed in libgit2-sys 0.14.2.

References

Show 29 moreShow less
MoveEnter Open