AgentbeamBeta
AI agent vulnerability · MCP reference servers

CVE-2025-68144: mcp-server-git argument injection in git_diff and git_checkout functions allows overwriting local files

mediumCVSS 4.0 6.3GHSA-9xwc-hfwc-8w59

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-git

If 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-git

The 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 entries