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.
Published: 2026-08-11
Score: 8.6 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The flaw exists in libgit2 versions before 1.8.7 and 1.9.0 before 1.9.7 when built with the libssh2 SSH backend. A vulnerable libgit2 implementation constructs a shell command by embedding a repository path directly into a string that is later executed by libssh2. An attacker can place shell metacharacters in the path, such as quotes, semicolons, or pipes, causing the command to be misinterpreted by the remote shell. The result is that the attacker can run arbitrary commands on the target SSH server under the victim’s user account. The weakness is a classic command injection (CWE-78, shell command injection). This flaw can be exploited during the processing of submodule URLs in a .gitmodules file during a recursive clone, making the impact wide and potentially system‑wide on the affected host.

Affected Systems

libgit2 versions earlier than 1.8.7 and 1.9.0 prior to 1.9.7 built with the libssh2 backend (USE_SSH=libssh2) are affected. No other vendor or product versions are listed as impacted.

Risk and Exploitability

The CVSS score of 8.6 indicates a high severity. The EPSS is less than 1 %, suggesting a low current exploitation probability, but this does not reduce the risk of a future attack. The issue is not listed in the CISA KEV catalog. The attack requires the attacker to supply a malicious submodule URL or repository path to a client that performs a recursive clone. If the client is run by a privileged user or provides access to critical resources, the attacker can gain arbitrary code execution on the remote SSH server.

Generated by OpenCVE AI on August 26, 2026 at 23:12 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade to a libgit2 release newer than 1.9.0 that fixes the command injection bug.
  • If an upgrade is not feasible, avoid using the libssh2 backend or disable the feature that constructs shell commands from repository paths.
  • Sanitise or escape any repository paths before they are passed to the SSH backend, or validate submodule URLs to ensure they do not contain shell metacharacters.

Generated by OpenCVE AI on August 26, 2026 at 23:12 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DSA Debian DSA DSA-6453-1 libgit2 security update
History

Wed, 26 Aug 2026 16:00:00 +0000

Type Values Removed Values Added
Description libgit2 versions v0.27.0 through v1.9.0 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. 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.
Title libgit2 v0.27.0-v1.9.0 Shell Command Injection via ssh_libssh2 Backend libgit2 Shell Command Injection via ssh_libssh2 Backend
CPEs cpe:2.3:a:libgit2:libgit2:*:*:*:*:*:*:*:*
References
Metrics cvssV3_1

{'score': 9.6, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.4, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H'}

cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.6, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Fri, 14 Aug 2026 17:15:00 +0000

Type Values Removed Values Added
CPEs cpe:2.3:a:libgit2:libgit2:*:*:*:*:*:*:*:*

Thu, 13 Aug 2026 12:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Important


Wed, 12 Aug 2026 13:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Wed, 12 Aug 2026 12:00:00 +0000

Type Values Removed Values Added
First Time appeared Libgit2
Libgit2 libgit2
Vendors & Products Libgit2
Libgit2 libgit2

Tue, 11 Aug 2026 21:45:00 +0000

Type Values Removed Values Added
Description libgit2 versions v0.27.0 through v1.9.0 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.
Title libgit2 v0.27.0-v1.9.0 Shell Command Injection via ssh_libssh2 Backend
Weaknesses CWE-78
References
Metrics cvssV3_1

{'score': 9.6, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H'}

cvssV4_0

{'score': 9.4, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-26T16:48:52.924Z

Reserved: 2026-04-08T20:02:31.343Z

Link: CVE-2026-5917

cve-icon Vulnrichment

Updated: 2026-08-12T12:48:26.831Z

cve-icon NVD

Status : Received

Published: 2026-08-11T22:17:37.390

Modified: 2026-08-26T16:16:29.803

Link: CVE-2026-5917

cve-icon Redhat

Severity : Important

Publid Date: 2026-08-11T21:40:29Z

Links: CVE-2026-5917 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-26T23:15:05Z

Weaknesses
  • CWE-78

    Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')