mcp-server-git 2026.11.11: a crafted `.git/index` makes read-only tools return files outside the `--repository` boundary
GHSA-r2q8-f657-4r56 · published 2026-11-18
- Severity
- Medium
- CVSS score
- Not scored
- Chance of exploitation (EPSS)
- No CVE
- Fixed in
- 2026.11.18
With --repository set, the full content of any file the server's user can read (SSH keys, .env files and tokens next to the workspace, other projects), returned by tools annotated read-only (git_diff_unstaged, git_diff), which a client may run without asking the user. The content lands in the model's context. git_status adds an existence oracle for arbitrary paths. There is no write and no command execution: we checked that git refuses to commit or check out such entries. Condition: the attacker controls the content of a .git directory that the server opens under --repository. …
Upgrade mcp-server-git to 2026.11.18 or later. If you start it from an MCP config with npx or uvx, pin that version so an old cached copy is not used.
Under --repository, in validate_opened_repo, list the index (git ls-files -z --stage) and refuse the repository if an entry is absolute or has an empty, ., .. or .git component. That is the rule git add already applies when it writes an entry. Verified through the server, on a local copy of 2026.11.11 patched as below: T1 to T4 are refused with an explicit error, and C1 and C2 are unchanged. The server's own test suite was not run on the patch. A test with a forged index next to the existing alternates tests. Not checked: the cost of ls-files on very large repositories, split index and sparse index, and a TOCTOU between the check and the git command if the index is rewritten in between.
| Package | Registry | Affected | Fixed in |
|---|---|---|---|
| mcp-server-git | PyPI | < 2026.11.18 | 2026.11.18 |
- CriticalMCP Path Traversal Allows Full-Filesystem Read and JWT Secret Exfiltration Leading to Account Takeoverlangflow, langflow-base
- CriticalVibe-Trading FastAPI endpoints permit unauthenticated access, file upload, and an RCE chainvibe-trading-ai
- Critical@zereight/mcp-gitlab: Unauthenticated arbitrary file read via `upload_markdown` enables PAT exfiltration and full account takeover@zereight/mcp-gitlab
- CriticalFlowise RCE via SQL Database Chain Nodeflowise, flowise-components
- CriticalLangroid: SQLChatAgent dangerous-function blocklist can be bypassed with quoted or schema-qualified pg_read_file callslangroid
- Criticalfast-mcp-telegram: Bearer token path traversal bypasses reserved Telegram session protectionfast-mcp-telegram
- Criticalmcp-server-git runs a repo's gpg.program via git_merge and git_branchmcp-server-git
- Criticalgit_add runs submodule filter commands when gitlink mode is not 160000mcp-server-git
- Criticalmcp-server-git: unexpandable sparse index lets submodule filter drivers runmcp-server-git
- Criticalgit: harden_repo ignores core.worktree, so repository-defined filters runmcp-server-git
- Criticalmcp-server-git --repository: checks a bare repo but runs a hidden .git's filtermcp-server-git
- Highgit: index entries under a symlink leak files outside --repositorymcp-server-git
The impact, patch and workaround text comes from the advisory, shortened (published by the MCP reference servers project). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.