---
id: CVE-2026-5917
title: >-
  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
  supp…
summary: >-
  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
  supp…
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'
cwe:
  - CWE-78
published: '2026-08-11'
updated: '2026-09-24'
sourceUpdated: '2026-09-24T20:43:32.537'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-5917'
references:
  - url: 'https://github.com/libgit2/libgit2/security/advisories/GHSA-xqj4-2j5v-rr75'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/libgit2-shell-command-injection-via-ssh-libssh2-backend
    label: disclosure@vulncheck.com
tags:
  - nvd
epss: 0.01427
epssPercentile: 0.71801
ingestedAt: '2026-09-24T20:51:40.197Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
