What’s Vulnerable › Vulnerabilities
CVE-2026-5917: libgit2 Shell Command Injection via ssh_libssh2 Backend
- Severity: high (CVSS 8.8 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 1.4% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2026-08-11 · updated 2026-09-24
- Weakness: CWE-78
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.
Affected products
- libgit2: before 1.8.7; from 1.9.0 before 1.9.7 — fixed in 1.8.7, 1.9.7
How to fix
Upgrade to a fixed version: libgit2 1.8.7, 1.9.7. Check the vendor advisory for mitigations.
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
Get alerted when CVE-2026-5917 or the next vulnerability affects your stack