{"id":"CVE-2023-22742","aliases":["CVE-2023-22742","GHSA-m4ch-rfv5-x5g3","GHSA-8643-3wh5-rmjq","RUSTSEC-2023-0003"],"related":[],"kind":"vulnerability","state":"published","title":"libgit2 fails to verify SSH keys by default","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"The git2 and libgit2-sys crates are Rust wrappers around the [libgit2](https://libgit2.org/) 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.\n\nThe libgit2 team assigned [CVE-2023-22742](https://github.com/libgit2/libgit2/security/advisories/GHSA-8643-3wh5-rmjq) to this vulnerability. The following versions of the libgit2-sys Rust crate have been released:\n\n* libgit2-sys 0.14.2, updating the underlying libgit2 C library to version 1.5.1.\n* libgit2-sys 0.13.5, updating the underlying libgit2 C library to version 1.4.5.\n\nA 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.\n\n[You can learn more about this vulnerability in libgit2's advisory](https://github.com/libgit2/libgit2/security/advisories/GHSA-8643-3wh5-rmjq)","format":"markdown","source":"ghsa"},{"lang":"en","text":"The git2 and libgit2-sys crates are Rust wrappers around the\n[libgit2]() C library. It was discovered that libgit2 1.5.0\nand below did not verify SSH host keys when establishing an SSH connection,\nexposing users of the library to Man-In-the-Middle attacks.\n\nThe libgit2 team assigned [CVE-2023-22742][libgit2-advisory] to this\nvulnerability. The following versions of the libgit2-sys Rust crate have been\nreleased:\n\n* libgit2-sys 0.14.2, updating the underlying libgit2 C library to version 1.5.1.\n* libgit2-sys 0.13.5, updating the underlying libgit2 C library to version 1.4.5.\n\nA new git2 crate version has also been released, 0.16.1. This version only\nbumps its libgit2-sys dependency to ensure no vulnerable libgit2-sys versions\nare used, but contains no code changes: if you update the libgit2-sys version\nthere is no need to also update the git2 crate version.\n\n[You can learn more about this vulnerability in libgit2's advisory][libgit2-advisory]\n\n[libgit2]: https://libgit2.org/\n[libgit2-advisory]: https://github.com/libgit2/libgit2/security/advisories/GHSA-8643-3wh5-rmjq","format":"markdown","source":"rustsec"},{"lang":"es","text":"libgit2 es una implementación de librería vinculable y multiplataforma de Git. Cuando se utiliza un control remoto SSH con el backend libssh2 opcional, libgit2 no realiza la verificación de certificados de forma predeterminada. Las versiones anteriores de libgit2 requieren que la persona que llama establezca el campo `certificate_check` de la estructura `git_remote_callbacks` de libgit2; si no se establece una devolución de llamada de verificación de certificado, libgit2 no realiza ninguna verificación de certificado. Esto significa que, de forma predeterminada, sin configurar una devolución de llamada de verificación de certificado, los clientes no realizarán la validación de las claves SSH del servidor y pueden estar sujetos a un ataque de intermediario. Se anima a los usuarios a actualizar a v1.4.5 o v1.5.1. Los usuarios que no puedan actualizar deben asegurarse de que todos los certificados relevantes se verifiquen manualmente.","source":"nvd"}],"published":"2023-01-20T12:00:00.000Z","modified":"2026-10-14T17:07:22.000Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N","score":5.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N","score":5.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N","score":6.8,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","score":5.9,"rating":"MEDIUM"}],"cwes":["CWE-347"],"affected":[{"ranges":[{"version":"< 1.4.5","status":"affected"},{"version":"= 1.5.0","status":"affected"}],"vendor":"libgit2","product":"libgit2","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0.14.0","status":"affected","fixed":"0.14.2"}],"ecosystem":"crates.io","package":"libgit2-sys","purl":"pkg:cargo/libgit2-sys","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.13.5"}],"ecosystem":"crates.io","package":"libgit2-sys","purl":"pkg:cargo/libgit2-sys","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.16.1"}],"ecosystem":"crates.io","package":"git2","purl":"pkg:cargo/git2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.13.5"},{"type":"semver","introduced":"0.14.0","status":"affected","fixed":"0.14.2"}],"ecosystem":"crates.io","package":"libgit2-sys","purl":"pkg:cargo/libgit2-sys","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"1.4.5"},{"status":"affected","version":"1.5.0"}],"vendor":"libgit2","product":"libgit2","cpe":"cpe:2.3:a:libgit2:libgit2:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/libgit2/libgit2/security/advisories/GHSA-8643-3wh5-rmjq","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/libgit2/libgit2/commit/42e5db98b963ae503229c63e44e06e439df50e56","tags":["patch","third-party-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://github.com/libgit2/libgit2/commit/cd6f679af401eda1f172402006ef8265f8bd58ea","tags":["patch","third-party-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://github.com/libgit2/libgit2/releases/tag/v1.4.5","tags":["release-notes","third-party-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://github.com/libgit2/libgit2/releases/tag/v1.5.1","tags":["release-notes","third-party-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://www.libssh2.org","tags":["third-party-advisory","x-refsource-misc","x-transferred"],"sources":["cvelist","nvd"]},{"url":"http://www.openwall.com/lists/oss-security/2023/11/06/5","tags":["x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://github.com/rust-lang/git2-rs/security/advisories/GHSA-m4ch-rfv5-x5g3","tags":["web"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-22742","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rust-lang/git2-rs/commit/87934f87d36753ed702792ec063be7246444a8e1","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/rust-lang/git2-rs","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2023-0003.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/libgit2-sys","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-03-10T20:59:36.699Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-22742","url":"https://www.cve.org/CVERecord?id=CVE-2023-22742","licence":"CVE Terms of Use","modified":"2025-03-10T21:21:08.962Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-m4ch-rfv5-x5g3","url":"https://github.com/advisories/GHSA-m4ch-rfv5-x5g3","licence":"CC-BY-4.0","modified":"2026-10-14T17:07:22.000Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2023-0003","url":"https://rustsec.org/advisories/RUSTSEC-2023-0003.html","licence":"CC0-1.0","modified":"2026-10-12T18:00:06.112Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-22742","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-22742","licence":"Public domain","modified":"2026-06-17T05:36:04.797Z"}],"updatedAt":"2026-11-25T22:58:21.691Z","epss":{"score":0.0063,"percentile":0.51522,"date":"2026-12-01T12:00:22.000Z"}}