UTC
Medium

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
What it is

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. …

What to do

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.

Affected
PackageRegistryAffectedFixed in
mcp-server-gitPyPI< 2026.11.182026.11.18

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.

Sources: GitHub Advisory Database, reviewed and malware advisories (CC BY 4.0, https://github.com/advisories); advisories published by Cursor (https://github.com/cursor/cursor/security/advisories); advisories published by OpenClaw (https://github.com/openclaw/openclaw/security/advisories); advisories published by vLLM (https://github.com/vllm-project/vllm/security/advisories); advisories published by Open WebUI (https://github.com/open-webui/open-webui/security/advisories); advisories published by n8n (https://github.com/n8n-io/n8n/security/advisories); advisories published by Flowise (https://github.com/FlowiseAI/Flowise/security/advisories); advisories published by Langflow (https://github.com/langflow-ai/langflow/security/advisories); advisories published by the MCP Python SDK project (https://github.com/modelcontextprotocol/python-sdk/security/advisories); advisories published by the MCP reference servers project (https://github.com/modelcontextprotocol/servers/security/advisories); advisories published by the MCP Inspector project (https://github.com/modelcontextprotocol/inspector/security/advisories); advisories published by the MCP TypeScript SDK project (https://github.com/modelcontextprotocol/typescript-sdk/security/advisories); advisories published by the MCP Go SDK project (https://github.com/modelcontextprotocol/go-sdk/security/advisories); advisories published by the MCP Java SDK project (https://github.com/modelcontextprotocol/java-sdk/security/advisories); advisories published by the MCP Kotlin SDK project (https://github.com/modelcontextprotocol/kotlin-sdk/security/advisories); advisories published by the MCP Rust SDK project (https://github.com/modelcontextprotocol/rust-sdk/security/advisories); advisories published by the MCP Ruby SDK project (https://github.com/modelcontextprotocol/ruby-sdk/security/advisories); advisories published by the MCP C# SDK project (https://github.com/modelcontextprotocol/csharp-sdk/security/advisories); advisories published by the MCP PHP SDK project (https://github.com/modelcontextprotocol/php-sdk/security/advisories); advisories published by the MCP Registry project (https://github.com/modelcontextprotocol/registry/security/advisories); advisories published by Open Terminal (https://github.com/open-webui/open-terminal/security/advisories); advisories published by MLflow (https://github.com/mlflow/mlflow/security/advisories); CISA Known Exploited Vulnerabilities catalog (CC0). Data as of 2026-12-06. ShieldMap describes how each problem works and how to fix it; it does not publish exploit code. Report a correction to [email protected].