CVE-2025-68144: mcp-server-git argument injection in git_diff and git_checkout functions allows overwriting local files
The git_diff and git_checkout tools in mcp-server-git before 2025.12.18 passed their argument to the git command line unchecked. A value such as --output=/path/to/file is read as an option, so a tool call can overwrite a local file. Upgrade mcp-server-git to 2025.12.18.
Published Dec 17, 2025 · Updated Dec 20, 2025 · Analysis Nov 9, 2026
What an attacker can do
The reference Git MCP server exposes git operations to an AI client. git_diff and git_checkout took a target argument and gave it straight to the git CLI. Git cannot tell a ref from an option, so a value that starts with - is parsed as a flag.
The advisory's example is --output=/path/to/file for git_diff. Git then writes the diff to that path and replaces whatever was there. That is argument injection (CWE-88) with an arbitrary file overwrite result, within the rights of the user running the server.
The arguments come from the model, so an attacker does not need access to the server. Text that steers the model, such as a prompt injection in a repository file, issue or web page, can lead it to issue the tool call. The CVSS 4.0 vector reflects that with user interaction set to passive. A file overwrite can damage shell profiles, git hooks or config files, which can turn into code execution later.
Who is affected
pip mcp-server-git before 2025.12.18, whether started with uvx or pip. Check with:
pip show mcp-server-gitIf you launch it with uvx mcp-server-git, pin or refresh the version in your MCP client config.
mcp-server-git
- Ecosystem
- PyPI
- Affected
- < 2025.12.18
- Fixed in
- 2025.12.18
- Check
pip show mcp-server-git
How to fix it
Upgrade to mcp-server-git 2025.12.18 or later:
pip install -U mcp-server-gitThe fix rejects any argument that starts with - and checks with rev_parse that the argument resolves to a real git ref before running the command. The advisory lists no workaround.
How to tell if you were hit
Look in MCP client logs for git_diff or git_checkout calls whose argument starts with --, mainly --output=. Check for files that were overwritten with diff-like content, such as dotfiles, hooks under .git/hooks, or config files. Beam records MCP tool calls and the files an agent touches, which gives you a trail for those calls.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
In mcp-server-git versions prior to 2025.12.18, the git_diff and git_checkout functions passed user-controlled arguments directly to git CLI commands without sanitization. Flag-like values (e.g., --output=/path/to/file for git_diff) would be interpreted as command-line options rather than git refs, enabling arbitrary file overwrites. The fix adds validation that rejects arguments starting with - and verifies the argument resolves to a valid git ref via rev_parse before execution. Users are advised to update to 2025.12.18 resolve this issue.
Thank you to https://hackerone.com/yardenporat for reporting.
Questions
- Does CVE-2025-68144 give code execution?
The advisory describes arbitrary file overwrite, not direct code execution. Overwriting files such as hooks or shell profiles could lead to code execution later, but the sources do not say so.
- How does the fix block the injection?
It rejects arguments starting with a dash and requires them to resolve to a valid git ref through rev_parse before the command runs.
- Is it connected to CVE-2025-68145?
Both are in mcp-server-git and both are fixed in 2025.12.18. They are different bugs: this one is argument injection, the other is a missing path check on --repository.
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-2026-27735
mcp-server-git : Path traversal in git_add allows staging files outside repository boundaries
medium6.4Feb 26, 2026CVE-2025-68143
mcp-server-git's unrestricted git_init tool allows repository creation at arbitrary filesystem locations
medium6.5Dec 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
