The vulnerability lies in the gix-transport crate, where parts of a user-provided URL, specifically the host and path, were used to construct shell commands without proper sanitization. An attacker could craft a URL with a host or path beginning with a hyphen (-), causing the subsequent ssh or git command to interpret it as a command-line option instead of a positional argument. This allows for OS command injection.
The analysis of the fixing commits reveals the exact locations where this vulnerability was addressed. The core of the fix was the introduction of Url::host_argument_safe() and Url::path_argument_safe() methods, which check if the respective URL components look like command-line arguments.
The key vulnerable functions identified are:
gix_transport::client::blocking_io::ssh::connect: Directly used url.host() to build an ssh command, which was patched to use url.host_argument_safe().
gix_transport::client::blocking_io::ssh::program_kind::ProgramKind::prepare_and_get_raw_command: Constructed ssh command arguments using the raw host from the URL. This was also patched to use the safe version of the host getter.
gix_transport::client::blocking_io::file::SpawnProcessOnDemand::invoke: Used the repository path when spawning a process, which could be malicious. The patch added a direct check to ensure the path does not start with a hyphen.
These functions are directly involved in processing the malicious URL and constructing the vulnerable command, making them the primary indicators that would appear in a runtime profile during exploitation.