Multiple security vulnerabilities have been revealed in GitHub Desktop and other Git-related projects that, if exploited, could allow attackers to gain unauthorized access to a user’s Git credentials.
According to GMO Flatt security researcher Ry0taK, who identified the flaws, “Git uses the Git Credential Protocol to retrieve credentials from the credential helper. Due to improper message handling, numerous projects became susceptible to credential leaks in various ways,” he explained in an analysis published on Sunday.
The identified vulnerabilities are as follows:
While the credential helper is designed to return credentials separated by the newline control character (“\n”), research has shown that GitHub Desktop is vulnerable to carriage return (“\r”) smuggling. By injecting this character into a crafted URL, an attacker can potentially leak credentials to an attacker-controlled host.
Hackers Inject Malicious Code in Chrome Extensions
“By using a maliciously crafted URL, it’s possible to cause the credential request from Git to be misinterpreted by GitHub Desktop, resulting in the credentials being sent to a different host than the one Git is communicating with, thus enabling secret exfiltration,” GitHub explained in an advisory.
A similar flaw was found in the Git Credential Manager NuGet package, where credentials can be exposed to unrelated hosts. Additionally, Git LFS was discovered to not check for embedded control characters, allowing for CRLF injection through crafted HTTP URLs.
The vulnerability in GitHub CLI exploits the fact that access tokens are configured to be sent to hosts other than github[.]com and ghe[.]com, as long as the environment variables GITHUB_ENTERPRISE_TOKEN, GH_ENTERPRISE_TOKEN, and GITHUB_TOKEN are set, and CODESPACES is enabled (set to “true”).
“While the enterprise-related variables are less common, the CODESPACES environment variable is always set to ‘true’ when running on GitHub Codespaces,” Ry0taK noted. “Thus, cloning a malicious repository in GitHub Codespaces using GitHub CLI will always leak the access token to the attacker’s hosts.”
Successful exploitation of these vulnerabilities could allow malicious third parties to use the leaked authentication tokens to access privileged resources.
Latest tech news and coding tips.
1. What Is the Golden Ratio? The Golden Ratio, represented by the Greek letter φ (phi), is…
In CSS, combinators define relationships between selectors. Instead of selecting elements individually, combinators allow you to target elements based…
Below is a comprehensive, beginner-friendly, yet deeply detailed guide to Boolean Algebra, complete with definitions, laws,…
Debugging your own code is hard enough — debugging someone else’s code is a whole…
Git is a free, open-source distributed version control system created by Linus Torvalds.It helps developers: Learn how to…
Bubble Sort is one of the simplest sorting algorithms in computer science. Although it’s not…