CVE-2026-27735: mcp-server-git : Path traversal in git_add allows staging files outside repository boundaries
The git_add tool in mcp-server-git before 2026.1.14 accepted file paths with ../ that resolve outside the repository and staged them in the Git index. A steered AI agent could then commit and push sensitive files from elsewhere on disk. Fixed in 2026.1.14.
Published Feb 26, 2026 · Analysis Oct 31, 2026
What an attacker can do
git_add used GitPython's repo.index.add(), which does not enforce working-tree boundaries for relative paths. A files argument such as ../../.ssh/id_rsa passed through and the file was staged. The Git CLI would have refused an out-of-tree path.
Staging alone does not leak anything. The exposure comes from the next steps: a commit and a push of the staged content to a remote the attacker can read. The usual route is an AI agent that has this MCP server connected and is steered by a malicious prompt, a poisoned README or a hostile web page, which makes it call git_add with traversal paths and then commit and push. The CVSS vector marks user interaction as present and the impact as high on subsequent systems, matching that chain.
The attacker needs a way to influence the agent's tool calls and a push destination, for example a remote already configured on the repo. They get files the server's user can read, such as keys, tokens and config from outside the repository.
Who is affected
The mcp-server-git pip package before 2026.1.14. It is part of the MCP reference servers. If you launch it with uvx, you may be on a cached older version.
pip show mcp-server-git
uvx mcp-server-git --helpCheck the version pinned in your MCP client configuration too.
mcp-server-git
- Ecosystem
- PyPI
- Affected
- < 2026.1.14
- Fixed in
- 2026.1.14
- Check
pip show mcp-server-git
How to fix it
Upgrade to mcp-server-git 2026.1.14.
pip install --upgrade mcp-server-git==2026.1.14Pull request 3164 switches to repo.git.add(), which calls the Git CLI and rejects out-of-tree paths. It also adds a path-within-repository check before staging and a -- separator so paths that start with a dash are treated as paths, not options. The sources name no workaround. Until you upgrade, disable the git MCP server, or run it where the repository directory holds no secrets nearby.
How to tell if you were hit
Check the repository's staged files for paths outside the working tree, and review git log for recent commits that add unexpected files, then check the remote for pushes you did not make:
git diff --cached --name-status
git log --stat -5In MCP client logs, look for git_add calls whose files argument contains ../ segments or absolute paths. If an AI agent calls the server, Beam's record of MCP tool calls and agent file access would list those git_add arguments.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
In mcp-server-git versions prior to 2026.1.14, the git_add tool did not validate that file paths provided in the files argument were within the repository boundaries. The tool used GitPython's repo.index.add(, which did not enforce working-tree boundary checks for relative paths. As a result, relative paths containing ../ sequences that resolved outside the repository were accepted and staged into the Git index, potentially allowing sensitive files to be exfiltrated via subsequent commit and push operations. The fix in PR #3164 switches to repo.git.add(), which delegates to the Git CLI and properly rejects out-of-tree paths. Users are advised to upgrade to 2026.1.14 or newer to remediate this issue.
mcp-server-git thanks https://hackerone.com/0dd-g for reporting and contributing the fix.
Questions
- Does git_add itself send files anywhere?
No. It only stages them. The data leaves the machine if a later commit and push step sends the staged files to a remote the attacker can read.
- Which version fixes CVE-2026-27735?
mcp-server-git 2026.1.14. Earlier versions accept paths with ../ that resolve outside the repository.
- Why did GitPython allow it?
repo.index.add() did not check working-tree boundaries for relative paths. The fix uses repo.git.add(), which delegates to the Git CLI and rejects out-of-tree paths.
- Is it exploited in the wild?
No source reports exploitation, and it is not in CISA's KEV catalog.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More MCP reference servers vulnerabilities
All MCP reference servers entriesCVE-2025-68143
mcp-server-git's unrestricted git_init tool allows repository creation at arbitrary filesystem locations
medium6.5Dec 17, 2025CVE-2025-68144
mcp-server-git argument injection in git_diff and git_checkout functions allows overwriting local files
medium6.3Dec 17, 2025CVE-2025-68145
mcp-server-git has missing path validation when using --repository flag
medium6.4Dec 17, 2025CVE-2025-53109
@modelcontextprotocol/server-filesystem allows for path validation bypass via prefix matching and symlink handling
high7.3No fixJul 1, 2025CVE-2025-53110
@modelcontextprotocol/server-filesystem vulnerability allows for path validation bypass via colliding path prefix
high7.3No fixJul 1, 2025
