CVE-2026-134465 in mcp-server-git
Summary
by MITRE • 11/23/2026
In mcp-server-git before 2026.10.28, the --repository restriction can be bypassed through a nested directory that contains a .git file with a gitdir pointer to a repository outside the allowed path. A caller who can invoke the server's tools, place such a file in the allowed tree, and knows the outside repository's path can read committed content from that repository and create branches in it.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability identified in mcp-server-git prior to version 2026.10.28 represents a critical directory traversal and path resolution flaw within the Git server implementation. This issue stems from an insufficient validation of file paths when processing repository restrictions, specifically regarding how nested directories containing .git files are handled. The core technical failure lies in the application's inability to correctly resolve or validate the actual location pointed to by a gitdir directive embedded within a .git file located inside an allowed directory tree. When mcp-server-git processes tools that interact with Git repositories, it checks whether the target path falls within the whitelisted repository boundaries. However, if a user can place a specially crafted .git file in any subdirectory of the permitted workspace, and this file contains a gitdir pointer referencing a location outside the allowed scope, the server fails to detect this redirection. Consequently, the security boundary defined by the --repository flag is effectively bypassed because the application trusts the internal structure of the .git metadata without verifying that the ultimate destination remains within the authorized context.
This architectural weakness allows an attacker who has the ability to invoke tools on the mcp-server-git interface and write files into the allowed directory tree to access sensitive data from external repositories. By creating a nested directory with a .git file pointing to a target repository outside the permitted path, the caller can trick the server into treating that external location as part of the current session's context. This leads to unauthorized read access to committed content within the targeted repository, exposing source code, configuration files, or other proprietary information that should remain isolated from the calling environment. Furthermore, the vulnerability extends beyond passive data exfiltration; it permits active manipulation of the target repository. An attacker can create new branches in the external repository, potentially introducing malicious commits, altering history, or causing denial of service through resource exhaustion if they possess write permissions to that remote location.
From a classification perspective, this flaw aligns with CWE-22 Improper Limitation of a Pathname to a Restricted Directory and CWE-78 OS Command Injection in contexts where the path resolution leads to unintended command execution against unauthorized resources. In terms of the MITRE ATT&CK framework, this vulnerability facilitates lateral movement or data staging by allowing an actor to pivot from a controlled environment into adjacent systems via file system artifacts rather than network exploits. The attack vector is primarily local or remote depending on how mcp-server-git is exposed, but it requires initial access to write files within the allowed tree and knowledge of the target repository's path structure. This makes it particularly dangerous in multi-tenant environments or CI/CD pipelines where shared workspaces are common, as a compromised build agent could potentially reach into other projects' repositories if proper isolation mechanisms fail due to this bug.
Mitigation strategies must focus on strict validation of resolved paths rather than just the initial input path. The primary fix implemented in version 2026.10.28 involves enhancing the logic that processes .git files and gitdir pointers to ensure they resolve to absolute paths within the allowed repository boundaries before any Git operations are executed. Developers should implement canonicalization of all file paths early in the request processing lifecycle, ensuring that symbolic links, relative references, and metadata-driven redirections like gitdir do not lead outside the designated sandbox. Additionally, runtime checks should verify that every intermediate directory component belongs to the authorized tree. For organizations still running older versions, immediate remediation involves upgrading to the patched release. In interim scenarios where upgrades are delayed, restricting file write permissions within the workspace directories can prevent attackers from placing malicious .git files, thereby neutralizing the attack vector until a permanent fix is deployed.