CVE-2026-5917 in libgit2info

Summary

by MITRE • 08/11/2026

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.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 08/12/2026

This vulnerability exists within the libgit2 library's SSH implementation where the gen_proto() function in ssh_libssh2.c fails to properly escape special characters in repository paths before incorporating them into shell commands. The flaw affects versions v0.27.0 through v1.9.0 when built with the libssh2 backend, creating a critical command injection vector that can be exploited by remote attackers. The vulnerability specifically targets the handling of submodule URLs within .gitmodules files during recursive clone operations, where unescaped shell metacharacters such as single quotes, semicolons, and pipes can be interpreted by the target server's shell. This represents a classic shell injection vulnerability that maps to CWE-78, which describes improper neutralization of special elements used in OS commands. The attack scenario begins when an attacker crafts a malicious submodule URL containing shell metacharacters that are then passed directly to libssh2_channel_exec() without proper sanitization or escaping.

The operational impact of this vulnerability is severe as it allows remote code execution under the privileges of the victim's SSH user account, potentially enabling attackers to gain persistent access to the system. When a victim performs a recursive git clone operation on a repository containing malicious submodule references, the vulnerable libgit2 library processes the unescaped repository path and executes the injected commands on the target server. This creates a significant risk for automated build systems, CI/CD pipelines, and any environment where automated git operations occur with elevated privileges. The vulnerability can be exploited in various contexts including web applications that perform git operations, continuous integration systems, and development environments where untrusted repositories are cloned. Attackers can leverage this to execute arbitrary commands, escalate privileges, or establish persistent backdoors on the affected systems.

Mitigation strategies for this vulnerability include immediate upgrading to libgit2 versions v1.9.1 or later where the shell command escaping has been properly implemented. Organizations should also implement proper input validation and sanitization of repository URLs, particularly when processing untrusted .gitmodules files. The recommended approach aligns with ATT&CK technique T1059.001 for Command and Scripting Interpreter, emphasizing the importance of preventing improper neutralization of special elements in OS commands. System administrators should also consider implementing network-level restrictions to prevent access to untrusted repositories, utilizing sandboxed environments for git operations, and monitoring for suspicious command execution patterns. Additionally, organizations should review their CI/CD pipelines and automated deployment processes to ensure they are not vulnerable to this attack vector, particularly when cloning repositories from external sources or handling third-party dependencies that may contain malicious submodule references.

Responsible

VulnCheck

Reservation

04/08/2026

Disclosure

08/11/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

very low

Sources

Want to stay up to date on a daily basis?

Enable the mail alert feature now!