A shell command injection vulnerability exists in libgit2 versions before 1.8.7 and 1.9.0 before 1.9.7 when built with the libssh2 SSH backend. This flaw allows remote attackers to execute arbitrary commands on an SSH server by supplying a repository path containing unescaped shell metacharacters. The vulnerability arises from the gen_proto() function in ssh_libssh2.c, which inserts the repository path directly into a shell command without escaping special characters. An attacker can exploit this by crafting a malicious submodule URL in a .gitmodules file, causing command execution during a recursive clone under the victim's SSH user account. A fix is available in version 1.3.2-4.oe2203sp4.