Where this started
We reported it through the project's private advisory process back in January. The published advisory can be accessed here. TL;DR: an executable-only allowlist doesn't bound what an "allowed" binary can do once it has its own argument-level execution primitives.
Why this keeps recurring in MCP specifically
MCP servers are a near-perfect environment for this bug to reappear. They exist specifically to give LLM agents shell access, so "restrict what the agent can run" is the very first security control anyone reaches for. Executable allowlisting is cheap to implement, easy to document, and looks complete in a README. It just doesn't hold up against any binary richer than echo.
The reason this matters more in agentic contexts than in a human-operated terminal is simple: a human running commands still has some notion of what they intended to type. An LLM constructing a command from context has no such guarantee, it's just synthesizing a plausible next action from whatever text it was fed, some of which came from a source with its own agenda. Treating the model's output as trusted input to your allowlist is the same mistake as treating any other unauthenticated input as safe. The model is not the attacker here, but it isn't a trustworthy narrator either.
The denylist trap
Once a maintainer recognizes that an allowed binary is dangerous, the natural next move is to patch around it: block the specific dangerous arguments instead of the whole binary. This is where a second, subtler failure mode shows up.
This is precisely the trap: a denylist of "known dangerous" arguments for a binary as feature-rich as git can't converge on complete. Git adds configuration keys over time. Every new one that shells out is a new bypass, and the defender is always one release behind the attacker's knowledge of git internals. The same logic applies to any sufficiently complex binary, you cannot enumerate every flag combination that results in code execution and call the list finished.
What this means for your threat model
If your MCP deployment, or any agentic tool execution layer, relies on a command allowlist as a security boundary, the question to ask is: "does this binary have any documented mechanism for invoking another program via its own arguments, config files, plugins, or extensions?" If yes, allowlisting the binary name buys you nothing against a motivated attacker, and effectively nothing against a compromised or manipulated LLM agent constructing commands on its own.
Practical takeaways for teams auditing MCP or agentic shell-execution tooling:
- Don't trust allowlist-only architectures. Executable-name validation is not equivalent to command sanitization. It is more of a convenience feature.
- Assume denylists of dangerous arguments will always be incomplete for any binary with a plugin, config, or scripting surface. A denylist approach needs a maintenance commitment matching the upstream binary's own release cadence, and realistically, nobody keeps this up.
- Prefer allowlisting behavior, not binaries. Where possible, run commands via
exec()-family calls (not shell reentry), strip or reject flags outside an explicit safe subset, and default-deny anything resembling-c,-exec,-e, or similar execution-adjacent flags regardless of which binary they're attached to. - Sandbox by default. If an MCP server executes arbitrary allowlisted binaries at all, isolate it: low-privilege user, container or VM boundary, restricted filesystem and network access.
- Test with the attacker's toolkit, not a client list. During review, don't just confirm the allowlist blocks unlisted binaries, actively try to invoke execution through every allowed binary's own argument surface. If you allow
git, try-c alias,core.fsmonitor,diff.external,core.editor. If you allowpython, try-c. Assume the binary is hostile and see what its own documentation gives you for free.
The conclusion is that "we validate against an allowlist" is frequently marketed as a security feature when it functions more as a configuration convenience. Our original finding on a single real-world MCP server made that case with one alias flag; the maintainer's own follow-up advisory, chasing a denylist that still doesn't close the gap, made it again with a different set of git config keys. For appsec and DevSecOps teams reviewing MCP servers or any agent-facing command execution layer, the real question is checking what those binaries can do once they're already trusted to run. Verify all pathways before you swipe right on a binary. ;)
Don't like doing things the manual way? Neither do we. Our open-source tool apisec mcp-audit detects unsafe injection-prone binaries in your MCP allowlists, plus a whole lot of other security risks, automatically. Give it a try!
