{"slug": "mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a", "title": "mcp-server-git ran the programs a repository's .git/config named. Asking your agent to read a repo already runs it", "summary": "The official MCP servers repository published five security advisories on 27 November, the most serious affecting mcp-server-git, the reference Git server for AI agents. Although the server strips repository-defined filters and hooks, a researcher found that with Git LFS installed, a malicious .git/config can still name programs that Git LFS reads for itself, so a read-only git_status call on an untrusted repository executes code with the user's privileges. The flaw is fixed in version 2026.11.27 without a CVE, meaning scanners will not flag it.", "body_md": "On 27 November, the official MCP servers repository published five security advisories. The most serious one hits `mcp-server-git`, the server that gives Git commands to an AI agent. It promised never to run a program named by the repository's own configuration. With Git LFS installed, the promise did not hold. A `git_status`, a read-only tool, was enough to run code with your rights.\n\n**TL;DR**: a `.git` directory supplied by someone else is code. Its `config` file can name a program, and Git runs it on the first `git status`. `mcp-server-git` emptied those keys, but not the ones Git LFS reads for itself. The fix is in version 2026.11.27, with no CVE number: your scanner will not warn you. Before you open a repository you did not clone yourself, list its filters, or run your agent without your tokens.\n\nState of the sources and of my machine: checked on 1 December 2026. Check the version of your MCP servers before you act.\n\nThis article is for developers who give Git tools to an AI agent, and for teams that let it read repositories they did not write.\n\nA normal clone does not carry the `.git/config` file. Your own Git creates it, on your machine. But a repository often arrives another way. A zip archive, a shared folder, a repository copied with its `.git`, a repository already on the machine. In those cases the `.git` comes along, and someone else wrote its content.\n\nThat file can name programs. A [filter](https://git-scm.com/docs/gitattributes) is the simplest example. The key `filter.<name>.clean` names a command, and a `.gitattributes` file says which files go through it. A [hook](https://git-scm.com/docs/githooks) does the same at other moments.\n\nThe detail that matters: after an archive unpacks, each file's timestamp no longer matches the index. Git then runs the `clean` filter again on every file it applies to, on the very first `git status`. No commit needed, no network needed. Reading the repository already runs it.\n\nI wrote in July that [an agent's rights in dev are not its rights in prod](https://jrobineau.com/en/blog/2026-07-23-ai-agent-permissions-dev-vs-prod.html). And in October that [every field an agent reads is a prompt](https://jrobineau.com/en/blog/2026-10-16-form-field-agent-reads-is-a-prompt.html). Here is the Git version of the same rule: every repository the agent opens is a program.\n\n[MCP](https://en.wikipedia.org/wiki/Model_Context_Protocol) is the protocol that connects an agent to tools. `mcp-server-git` is the reference server for Git, maintained in the official `modelcontextprotocol/servers` repository. It exposes tools such as `git_status`, `git_diff`, `git_show`, `git_checkout` and `git_merge`.\n\nIts README has a section on this exact topic, \"A repository's own programs\". It is clear: \"the server never runs a program they name, with or without `--repository`\". To keep that promise, every Git command it runs overrides the repository's configuration. Hooks point at the null device. External diffs are off. Every filter and every merge driver the repository defines is emptied.\n\nThe same README adds one sentence: \"Drivers from your global or system configuration, such as Git LFS's, keep working\". That makes sense. The LFS filter comes from your own configuration, not from the repository. It is trusted. That is where the researcher looked.\n\n[Git LFS](https://en.wikipedia.org/wiki/Git_LFS) stores large files outside the repository. The command `git lfs install` writes four keys into your global config: `filter.lfs.clean`, `filter.lfs.smudge`, `filter.lfs.process` and `filter.lfs.required`. From then on, Git calls `git-lfs` for every LFS-tracked file.\n\nThe problem fits in one sentence. The `git-lfs` program, started by your trusted filter, then reads its own settings from the repository's `.git/config`. And several of those settings name a program. Advisory [GHSA-6663-fm5v-gqm5](https://github.com/modelcontextprotocol/servers/security/advisories/GHSA-6663-fm5v-gqm5) lists them, each confirmed by a test:\n\n`lfs.extension.<name>.clean`: run by `git_status`, `git_diff_unstaged`, `git_diff` and `git_add`\n`lfs.extension.<name>.smudge`: run by `git_checkout` and `git_merge`\n`lfs.standalonetransferagent` with `lfs.customtransfer.<name>.path`: run by `core.sshCommand`, `credential.helper` and `core.askpass`: run by `lfs.url` points at a server the repository chooses\nThe `git_status` case is the worst. It needs no network and no LFS object. The result sent back to the agent says \"nothing to commit, working tree clean\". Nothing shows that a program just ran with your rights.\n\n**A read-only git_status ran the program the repository named.** The server empties the repository's filters, but your LFS filter stays active, and git-lfs reads its config from the repository. The reply to the agent shows nothing.\n\nThe researcher tested version 2026.11.18, with git 2.54.0 and git-lfs 3.7.1, on macOS. The official Docker image is affected in every case: its `Dockerfile` runs `git lfs install --system`. And the documented Docker setup mounts your home directory read-write into the container.\n\nThe fix shipped on 27 November, version 2026.11.27 on PyPI. The README now says the repository's LFS keys are emptied too: `lfs.extension.*`, `lfs.customtransfer.*`, `lfs.standalonetransferagent`. And the server never downloads an LFS object any more: `GIT_LFS_SKIP_SMUDGE=1`. A `git_checkout` writes the pointer files, and you run `git lfs pull` yourself afterwards.\n\nThe four other advisories of 27 November are smaller, but they tell the same story. The server promises a boundary, and a detail of Git slips through.\n\n`.git` file that contains `gitdir: /other/repo/.git` retargets the configured root. `git_show` then reads the commits of another repository on the machine, despite `--repository`. Medium severity.`.git/objects/info/alternates` during a `.env`, despite the `--no-overwrite-ignore` option. Low severity, since 2026.11.4.\nOn 1 December, none of the five has a CVE number. None is in GitHub's global advisory database: the API answers 404. The OSV database knows no vulnerability for `mcp-server-git` 2026.11.18. So Dependabot will not open a PR, and `pip-audit` will say everything is fine. The only source is the repository's Security tab.\n\nI already wrote that [your vulnerability scanner is itself a dependency](https://jrobineau.com/en/blog/2026-11-17-pin-your-vulnerability-scanner-supply-chain.html). Here it is simpler still: the scanner has nothing to scan. The information never entered its databases.\n\n**Five advisories, zero CVEs, one version that fixes them.** As long as the advisories have no number, Dependabot and pip-audit stay silent. The update is a manual decision.\n\nI checked my machine on 1 December. My Claude Code configuration declares MCP servers in 6 projects out of 94. The servers are context7, playwright, a Dokploy server, a Pixellab server and a Blender server. My Codex declares a `node_repl` and the same Blender server. No `mcp-server-git`, and the package is not installed.\n\nI could stop there. That would be a mistake. Git 2.53.0 and git-lfs 3.7.1 are installed, and I ran `git lfs install` one day: my global config holds the four `filter.lfs.*` keys. The advisory's condition is met on my machine. And my agents do not need `mcp-server-git` to run Git. Claude Code runs `git status` itself in every repository I open.\n\nThat is the real point. `mcp-server-git` at least tried to empty the repository's config. A `git status` an agent runs in a shell tries nothing at all. A repository delivered with its `.git`, a filter declared inside, a `.gitattributes` that applies it. The program runs with my rights, my SSH keys and my tokens. I replayed the advisory's proof-of-concept script on my machine on 1 December, in a temporary directory, with no network. With `mcp-server-git` 2026.11.18, `git_status` answered \"working tree clean\" and the program named by `.git/config` ran as my user. With 2026.11.27, the tool returns an error and nothing runs.\n\nAt home today, two hooks filter my agent's commands before they run, not a separate user. They would have blocked nothing here: `git status` is an allowed command. The problem is the program behind it, and a command filter cannot see it.\n\nIn November, [a security tool added itself to my agent's config](https://jrobineau.com/en/blog/2026-11-13-security-tool-added-itself-to-agent-config.html). The lesson was the same: what enters the agent's configuration decides what it runs. The `.git/config` of an unknown repository is one more configuration.\n\nFirst check: list the programs the repository's config names. One command, to run before any `git status`, before you open the agent in the folder:\n\n```\ngit -C /path/to/repo config --local --get-regexp \\\n  '^(filter|merge|diff|lfs\\.extension|lfs\\.customtransfer|lfs\\.standalonetransferagent|core\\.(hooksPath|fsmonitor|sshCommand|askpass)|credential\\.helper)'\nls -l /path/to/repo/.git/hooks | grep -v '\\.sample$'\ncat /path/to/repo/.git 2>/dev/null   # a file, not a directory: read where gitdir points\n```\n\nOn a repository you cloned yourself, the first command returns nothing, or only your own settings. On a repository received with its `.git`, every line is a program you did not choose. The second command shows the real hooks: `.sample` files are inert, the others run. The third one catches the `gitdir:` pointer of the second advisory.\n\nSecond check: pin the server version, and watch the repository's Security tab rather than Dependabot. `uvx mcp-server-git@2026.11.27` or `pip install mcp-server-git==2026.11.27`. For the Memory server, `@modelcontextprotocol/server-memory@2.2.2`. Write down the date of your last visit to the advisories page, because nothing will come and find you.\n\nThird check, the only one that holds when the first two fail: run the agent without your tokens. A separate Unix user, with no `~/.ssh`, no cloud credentials file, no `git lfs install`. Or a container with only the repository mounted, and `GIT_LFS_SKIP_SMUDGE=1` in its environment. If a program runs anyway, it runs with nothing. That is the rule of [my article on agent rights](https://jrobineau.com/en/blog/2026-07-23-ai-agent-permissions-dev-vs-prod.html), applied to Git.\n\nAs an aside, the `everything` server in the same repository listened on every network interface by default. PR 5452, merged on 5 November, brought it back to `127.0.0.1`. Same family: a reference server is not a hardened server.\n\nA repository received with its .git is a program. Read its config before you let the agent read its files.\n\n`git config --local --get-regexp` on `filter`, `merge`, `diff`, `lfs.*`, `core.hooksPath`, `.git/hooks` without the `.sample` files, and read the `gitdir:`\n`git lfs install` wrote `filter.lfs.*` into your global config: `git config --global --get-regexp '^filter\\.lfs'`\n`mcp-server-git` to 2026.11.27 and `server-memory` to 2.2.2, with the versions pinned in your MCP config`modelcontextprotocol/servers`: these advisories have no CVE, Dependabot will not see them`~/.ssh` and no tokens, with `GIT_LFS_SKIP_SMUDGE=1`\n`mcp-server-git` did better than most tools: it wrote down its promise, and someone could test it. The flaw is in the layer below, where a trusted program reads a configuration that is not. Git has always worked this way.\n\nYour agent cannot tell a repository you cloned from an archive someone sent you. You can. One command before you open, one user without tokens to run. The rest is trust, and trust cannot be scanned.\n\nWant to know what your agents can run with your rights today? Have a look at my [DevSecOps audit offer](https://jrobineau.com/en/services/devsecops-forfait.html), or [let's talk](https://jrobineau.com/en/contact.html).", "url": "https://wpnews.pro/news/mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a", "canonical_source": "https://dev.to/julesrobineau/mcp-server-git-ran-the-programs-a-repositorys-gitconfig-named-asking-your-agent-to-read-a-repo-4d32", "published_at": "2026-12-06 07:03:00+00:00", "updated_at": "2026-12-06 07:14:39.590552+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["mcp-server-git", "Model Context Protocol", "modelcontextprotocol/servers", "Git LFS", "GitHub"], "also_reported_by": [], "takeaway": "A .git directory from an untrusted source is executable code: with Git LFS installed, mcp-server-git's read-only git_status could run programs named in the repository's .git/config, so upgrade to 2026.11.27 and inspect filters before opening repos you did not clone yourself.", "recommendation": {"advice": "Upgrade mcp-server-git to 2026.11.27 and list a repository's filter and LFS settings before letting an agent open any repo you did not clone yourself.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a", "markdown": "https://wpnews.pro/news/mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a.md", "text": "https://wpnews.pro/news/mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a.txt", "jsonld": "https://wpnews.pro/news/mcp-server-git-ran-the-programs-a-repository-s-git-config-named-asking-your-to-a.jsonld"}}