CVE-2026-5917 libgit2 Shell Command Injection via ssh_libssh2 Backend
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- No known exploitation · automatable: no · technical impact: total
- Technology
- UbuntuDebianRed Hat
Description
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.
Upgrade path
10 packages: 9 fixed, 1 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| redhat/libgit2(Red Hat enterprise_linux_ai 3) | All versions | No fix listed | No fix yet |
| alpine/libgit2(Alpine v3.23) | < 1.9.7-r0 | 1.9.7-r0 | Fixed |
| alpine/libgit2(Alpine v3.24) | < 1.9.7-r0 | 1.9.7-r0 | Fixed |
| debian/libgit2(Debian 12) | < 1.5.1+ds-1+deb12u2; = 1.5.1+ds-1; = 1.5.1+ds-1+deb12u1 | 1.5.1+ds-1+deb12u2 | Fixed |
| debian/libgit2(Debian 13) | < 1.9.0+ds-2+deb13u1; = 1.9.0+ds-2 | 1.9.0+ds-2+deb13u1 | Fixed |
| debian/libgit2(Debian 14) | < 1.9.7+ds-1; = 1.9.0+ds-2; = 1.9.1+ds-1; = 1.9.2+ds-1 +11 more | 1.9.7+ds-1 | Fixed |
| libgit2 | < 1.8.7; >= 1.9.0, < 1.9.7 | 1.8.7, 1.9.7 | Fixed |
| ubuntu/libgit2(Ubuntu 22.04) | < 1.1.0+dfsg.1-4.1ubuntu0.1+esm2 | 1.1.0+dfsg.1-4.1ubuntu0.1+esm2 | Fixed |
| ubuntu/libgit2(Ubuntu 24.04) | < 1.7.2+ds-1ubuntu3.2 | 1.7.2+ds-1ubuntu3.2 | Fixed |
| ubuntu/libgit2(Ubuntu 26.04) | < 1.9.1+ds-1ubuntu1.2 | 1.9.1+ds-1ubuntu1.2 | Fixed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| libgit2 | < 1.8.7 | 1.8.7 |
| libgit2 | >= 1.9.0, < 1.9.7 | 1.9.7 |
| redhat/libgit2(Red Hat:enterprise_linux_ai:3) | All versions | No fix listed |
| debian/libgit2(Debian:12) | < 1.5.1+ds-1+deb12u2 | 1.5.1+ds-1+deb12u2 |
| debian/libgit2(Debian:12) | = 1.5.1+ds-1 | No fix listed |
| debian/libgit2(Debian:12) | = 1.5.1+ds-1+deb12u1 | No fix listed |
| debian/libgit2(Debian:13) | < 1.9.0+ds-2+deb13u1 | 1.9.0+ds-2+deb13u1 |
| debian/libgit2(Debian:13) | = 1.9.0+ds-2 | No fix listed |
| debian/libgit2(Debian:14) | < 1.9.7+ds-1 | 1.9.7+ds-1 |
| debian/libgit2(Debian:14) | = 1.9.0+ds-2 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.1+ds-1 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-1 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-2 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-3 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-4 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-5 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-6 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-7 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-8 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.2+ds-9 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.3+ds-1 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.4+ds-1 | No fix listed |
| debian/libgit2(Debian:14) | = 1.9.6+ds-1 | No fix listed |
| ubuntu/libgit2(Ubuntu:22.04) | < 1.1.0+dfsg.1-4.1ubuntu0.1+esm2 | 1.1.0+dfsg.1-4.1ubuntu0.1+esm2 |
| alpine/libgit2(Alpine:v3.23) | < 1.9.7-r0 | 1.9.7-r0 |
Show 3 more
| Product | Affected versions | Fixed in |
|---|---|---|
| alpine/libgit2(Alpine:v3.24) | < 1.9.7-r0 | 1.9.7-r0 |
| ubuntu/libgit2(Ubuntu:24.04) | < 1.7.2+ds-1ubuntu3.2 | 1.7.2+ds-1ubuntu3.2 |
| ubuntu/libgit2(Ubuntu:26.04) | < 1.9.1+ds-1ubuntu1.2 | 1.9.1+ds-1ubuntu1.2 |
References
- GitHub Security Advisory (GHSA-xqj4-2j5v-rr75) patch vendor-advisory
- www.vulncheck.com third-party-advisory
- Red Hat CVE page mitigation vendor-advisory
- Red Hat Bugzilla 2514416 issue-tracking
- www.cve.org
- nvd.nist.gov
- github.com
- Debian Security Tracker CVE-2026-5917 vendor-advisory
- Ubuntu CVE tracker vendor-advisory
- USN-8809-1 vendor-advisory
- security.alpinelinux.org vendor-advisory
- bugs.debian.org issue-tracking
- ENISA EUVD EUVD-2026-57011 third-party-advisory