A series of security vulnerabilities have been discovered in GitHub Desktop and other Git-related projects, potentially allowing attackers to steal Git credentials. These flaws, identified under the name Clone2Leak, are primarily related to the handling of credential retrieval in Git’s systems, particularly the Git Credential Protocol. The vulnerabilities exploit improper handling of messages, where maliciously crafted URLs can lead to the leakage of sensitive data. These flaws can be triggered through various components like GitHub Desktop, Git Credential Manager, and Git LFS, as well as the GitHub CLI.
One major vulnerability involves GitHub Desktop, where a malicious URL can cause credentials to be sent to an attacker-controlled host, exposing them to unauthorized access. Another weakness has been identified in Git Credential Manager, where a carriage-return character in remote URLs can result in credential leakage. Additionally, Git LFS does not properly check for embedded control characters, leading to a carriage return line feed (CRLF) injection through crafted HTTP URLs.
These vulnerabilities allow for the exfiltration of user credentials to attackers, who could use them to access privileged resources.
GitHub CLI has also been found to be vulnerable, especially when used in GitHub Codespaces. A specific exploit in GitHub CLI causes access tokens to be leaked when cloning malicious repositories. This issue arises because certain environment variables are configured to send tokens to non-GitHub hosts, making it easier for attackers to steal tokens when cloning repositories from compromised sources. GitHub has acknowledged these issues and has taken steps to address them, including treating the carriage return vulnerability as a standalone issue and releasing patches in updated versions.
In response to these vulnerabilities, GitHub has advised users to update their software to the latest versions to patch the flaws. For those unable to patch immediately, mitigation measures include avoiding the use of certain Git commands, such as –recurse-submodules when cloning untrusted repositories. Additionally, it’s recommended to disable the credential helper when cloning publicly available repositories to further reduce the risk of credential exposure. These measures are essential to protect against the potential theft of sensitive Git credentials.