Git Patches Flaw That Lets Malicious Repositories Execute Code During Recursive Clones
About 4 min read
securitysoftware
A critical vulnerability in the Git version‑control system that could allow malicious code execution during recursive cloning has been patched. The flaw, identified as CVE‑2026‑111760, stems from an integer truncation error in Git’s handling of its index when processing extremely long file paths. An attacker can craft a repository with a path that passes Git’s safety checks, only for Git to truncate the name when writing it to disk. The truncated name can be set to “.git”, enabling the attacker to replace a submodule’s .git file with a symbolic link that points to a directory containing malicious hooks or configuration files. Because Git runs hooks automatically at defined points, the attacker’s code can be executed as soon as the compromised repository or submodule is used.
The vulnerability specifically exploits the way Git treats submodules. While Git normally refuses to replace a .git directory with a symbolic link, a freshly cloned submodule stores its .git reference as a file rather than a directory. This nuance allows the malicious symbolic link to be introduced without triggering the usual protection. Once the submodule is cloned, the symbolic link directs Git to a location under the attacker’s control, and any hooks placed there are run with the privileges of the user performing the clone. The risk is amplified in environments that perform recursive clones of repositories with many nested submodules, a common practice in large codebases and continuous‑integration pipelines.
Git’s maintainers released a series of patches this week to close the issue. The primary fix appears in Git 2.56.1, and back‑ported updates are available for the 2.50 through 2.55 series as follows: 2.50.2, 2.51.3, 2.52.1, 2.53.1, 2.54.1 and 2.55.1. These versions add a pre‑emptive check that rejects paths exceeding the safe length before any truncation can occur, thereby preventing the creation of a malicious “.git” entry. The release announcement also notes that five additional flaws were addressed in the same update cycle, though the details of those issues are not the focus of this report.
GitHub, which bundles its own copy of Git in many of its developer tools, issued a detailed advisory outlining the remediation steps. The company recommends that users install a patched Git version from their operating‑system package manager or directly from the Git distributor. It also urges developers to update any applications that embed their own Git binaries. GitHub has already applied the patches to its core services, including the public github.com platform and GitHub Enterprise Cloud. For on‑premises deployments, the fixes are incorporated in GitHub Enterprise Server versions 3.19.15, 3.20.11, 3.21.9 and 3.22.4. Updates for GitHub Desktop and the GitHub Copilot desktop application are in preparation, and the patched Git will also be rolled out to GitHub Codespaces and GitHub Actions.
The timing of the fix is notable because Git for Windows had not yet released a version based on Git 2.56.1 at the time of reporting. A review of the project’s release tags by The Hacker News confirmed the absence of a Windows build as of Tuesday 19:09 UTC. Users of Git for Windows are therefore advised to monitor the official repository for an upcoming release and to apply it as soon as it becomes available.
Until a patched version is installed, GitHub suggests mitigation steps that do not replace the underlying fix. These include avoiding recursive clones of untrusted repositories, inspecting submodule configurations before cloning, and ensuring that any custom hooks are reviewed for authenticity. While these measures can reduce exposure, they do not eliminate the underlying vulnerability and should be considered temporary safeguards.
The issue also has implications for other code‑hosting platforms. GitLab assigned its own identifier, CVE‑2026‑105437, to a related flaw that can be triggered via the git‑merge‑tree command used in merge‑request validation. In that scenario, an attacker can set the conflict‑marker‑size attribute in a .gitattributes file to cause a server to process maliciously large conflict markers. GitLab advises that servers unable to upgrade immediately add “conflict-marker-size=7” to each repository’s info/attributes file or disable merge checks on untrusted repositories as a workaround.
For ShieldPack readers who rely on Git for development, continuous integration, or deployment pipelines, the practical impact of this vulnerability is clear. Any workflow that automatically clones repositories—including nested submodules—without verifying the source could inadvertently execute attacker‑supplied code. Updating to the patched Git versions eliminates the root cause, while the interim mitigations help reduce risk in environments where immediate upgrades are not feasible. Organizations should audit their Git client versions across developer machines, CI runners, and build servers, and prioritize the rollout of the fixed releases to maintain a secure development ecosystem.
A new technique called Weight2Shell has been disclosed by cybersecurity researchers, which allows artificial intelligence (AI) models to produce different behavior on different machines, eve…
Season 2: Legacy for Gears of War: E‑Day launches tomorrow, marking the franchise’s twentieth anniversary and offering a wave of new content for both veteran players and newcomers. The updat…
Hela: of Mice & Magic is set to launch on December 1, 2026 for Xbox Series X|S, and the title will be available on day one through Xbox Game Pass. The game presents an open‑world adventure i…