CVE-2025-68145: mcp-server-git has missing path validation when using --repository flag
mcp-server-git before 2025.12.18 did not enforce its --repository restriction. Tool calls could pass a repo_path outside the configured repository, so git operations ran on other repositories the server process could read. 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
Starting the Git MCP server with --repository is meant to confine it to one repository. In affected versions the repo_path argument of later tool calls was never compared with that path. A client, or a model steered by injected text, can set repo_path to any other repository the server's user can access.
What that means depends on the tool called. Read tools such as log, diff and show can disclose history and code from repositories you meant to keep out of reach, which might hold secrets committed by mistake. Write tools can change state in them. The restriction was the only boundary, so users relied on it to scope an agent to a single project.
The CWE is path traversal (CWE-22). The CVSS 4.0 vector shows impact in a subsequent system (SC:H, SI:H) and passive user interaction. No account on the server is needed beyond the ability to make tool calls, and the model can make them.
Who is affected
pip mcp-server-git before 2025.12.18, specifically setups that start the server with --repository and expect it to hold a boundary. Check with:
pip show mcp-server-gitLook in your MCP client config for the --repository argument.
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 resolves both the configured repository and the requested path, following symlinks, and checks that the request is inside the allowed repository before any git operation runs. The advisory gives no workaround.
How to tell if you were hit
Review MCP tool-call logs for git tool calls whose repo_path differs from the path set in --repository. Check other repositories on the host for unexpected commits, branch changes or reads. Beam records MCP tool calls and file access by agents, so you can compare the paths an agent touched with the repository you meant it to use.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
In mcp-server-git versions prior to 2025.12.18, when the server is started with the --repository flag to restrict operations to a specific repository path, it did not validate that repo_path arguments in subsequent tool calls were actually within that configured path. This could allow tool calls to operate on other repositories accessible to the server process. The fix adds path validation that resolves both the configured repository and the requested path (following symlinks) and verifies the requested path is within the allowed repository before executing any git operations. Users are advised to upgrade to 2025.12.18 to remediate this issue.
Thank you to https://hackerone.com/yardenporat for reporting.
Questions
- Does CVE-2025-68145 affect a server started without --repository?
The advisory describes the flaw for servers started with --repository, which is meant to restrict operations to one path. It does not address other setups.
- How does the fix check paths?
It resolves the configured repository and the requested path, follows symlinks, and verifies the request lies within the allowed repository before running git.
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-68144
mcp-server-git argument injection in git_diff and git_checkout functions allows overwriting local files
medium6.3Dec 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
