CVE-2026-5917libgit2 Shell Command Injection via ssh_libssh2 Backend
libgit2 versions before 1.8.7 and 1.9.0 before 1.9.7 built with the libssh2 SSH backend (USE_SSH=libssh2) contain a shell command injection vulnerability that allows remote attackers to execute arbitrary commands on an SSH server by supplying a repository path containing unescaped shell metacharacters such as single quotes, semicolons, or pipes. The gen_proto() function in ssh_libssh2.c inserts the repository path directly into a shell command string without escaping special characters before passing it to libssh2_channel_exec(), enabling an attacker to craft a malicious submodule URL in a .gitmodules file that, when processed during a recursive clone, causes the remote server's shell to interpret injected commands under the victim's SSH user account.
What to do
Fixed builds are available from Alpine, Debian, Ubuntu: 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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | libgit2 | Fixed | 1.9.1+ds-1ubuntu1.2 | UBUNTU-CVE-2026-5917 |
| Ubuntu 24.04 | libgit2 | Fixed | 1.7.2+ds-1ubuntu3.2 | UBUNTU-CVE-2026-5917 |
| Ubuntu 22.04 | libgit2 | Fix pending | 1.1.0+dfsg.1-4.1ubuntu0.1+esm2 (Ubuntu Pro) | UBUNTU-CVE-2026-5917 |
| Ubuntu 20.04 | libgit2 | Fix pending | 0.28.4+dfsg.1-2ubuntu0.1+esm2 (Ubuntu Pro) | UBUNTU-CVE-2026-5917 |
| Ubuntu 18.04 | libgit2 | Fix pending | 0.26.0+dfsg.1-1.1ubuntu0.2+esm3 (Ubuntu Pro) | UBUNTU-CVE-2026-5917 |
| Ubuntu 16.04 | libgit2 | Fix pending | 0.24.1-2ubuntu0.2+esm4 (Ubuntu Pro) | UBUNTU-CVE-2026-5917 |
| Debian 14 | libgit2 | Fixed | 1.9.7+ds-1 | DEBIAN-CVE-2026-5917 |
| Debian 13 | libgit2 | Fixed | 1.9.0+ds-2+deb13u1 | DEBIAN-CVE-2026-5917 |
| Debian 12 | libgit2 | Fixed | 1.5.1+ds-1+deb12u2 | DEBIAN-CVE-2026-5917 |
| Red Hat Enterprise Linux 10 | cargo | Not affected | ||
| Red Hat Enterprise Linux 10 | clippy | Not affected | ||
| Red Hat Enterprise Linux 10 | rust | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-analyzer | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-debugger-common | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-doc | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-gdb | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-lldb | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-src | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-std-static | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-std-static-aarch64-unknown-none-softfloat | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-std-static-wasm32-unknown-unknown | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-std-static-wasm32-wasip1 | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-std-static-x86_64-unknown-none | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-toolset | Not affected | ||
| Red Hat Enterprise Linux 10 | rust-toolset-srpm-macros | Not affected | ||
| Red Hat Enterprise Linux 10 | rustfmt | Not affected | ||
| Red Hat Enterprise Linux 9 | cargo | Not affected | ||
| Red Hat Enterprise Linux 9 | clippy | Not affected | ||
| Red Hat Enterprise Linux 9 | rust | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-analysis | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-analyzer | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-debugger-common | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-doc | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-gdb | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-lldb | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-src | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-std-static | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-std-static-wasm32-unknown-unknown | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-std-static-wasm32-wasi | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-std-static-wasm32-wasip1 | Not affected | ||
| Red Hat Enterprise Linux 9 | rust-toolset | Not affected | ||
| Red Hat Enterprise Linux 9 | rustfmt | Not affected | ||
| Red Hat Enterprise Linux 8 | libgit2 | Not affected | ||
| Red Hat Enterprise Linux 8 | libgit2-devel | Not affected | ||
| Alpine Linux 3.24 | libgit2 | Fixed | 1.9.7-r0 | ALPINE-CVE-2026-5917 |
| Alpine Linux 3.23 | libgit2 | Fixed | 1.9.7-r0 | ALPINE-CVE-2026-5917 |
What the vendor says
As published in the CVE record by VulnCheck, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- libgit2: affected: before 1.8.7, 1.9.0 to before 1.9.7; fixed in
1.8.7,1.9.7
Vendor advisories:
- https://github.com/libgit2/libgit2/security/advisories/GHSA-xqj4-2j5v-rr75 (patch, vendor-advisory)
References
- https://github.com/libgit2/libgit2/security/advisories/GHSA-xqj4-2j5v-rr75
- https://www.vulncheck.com/advisories/libgit2-shell-command-injection-via-ssh-libssh2-backend
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.