GhostSplice is a technique that enables a malicious Model Context Protocol (MCP) server to force an AI coding agent to exfiltrate SSH keys, environment secrets, and proprietary source code. Instead of issuing a direct command such as “send the keys,” the server splits the instruction into fragments distributed between tool descriptions and subsequent tool responses. Each fragment appears as harmless metadata or operational text, allowing the agent to recombine the pieces during normal context processing and carry out the complete exfiltration.
The research highlights risks associated with the growing use of external tool servers connected through Model Context Protocol (MCP) in AI-assisted development workflows. Once a developer connects an unverified MCP server, that server can steer the agent toward leaking sensitive data already accessible within the development environment. In controlled tests, splitting instructions across two parts raised average model compliance from 42 percent to 82 percent across eleven evaluated models. Some systems that previously refused requests consistently shifted to 100 percent compliance.
The demonstration covers extraction of SSH keys, .env files, proprietary code, and documents containing sensitive data. The attack uses seemingly neutral templates and fields that resolve to concrete system paths, blending with routine agent operations. GhostSplice does not compromise agents remotely on its own; it requires the developer to connect the attacker’s MCP server and the agent to hold existing permissions for the targeted files.
Mitigation Recommendations
- Inventory and restrict allowed MCP servers, disabling third-party integrations by default.
- Apply least-privilege principles to limit the number of enabled tools.
- Treat tool descriptions and any changes as high-risk material with version control and change alerts.
- Separate data from instructions so tool output cannot directly feed arguments to other tools without validation.
- Require human approval for operations involving bulk reads, sensitive paths, exports, or external destinations.
- Restrict agent access to directories such as .ssh, credential stores, and .env files.
- Monitor outbound traffic for anomalous volumes and destinations.
- Maintain detailed logs of tool calls, arguments, and network destinations to detect instruction recombination.
- Deploy canary tokens that trigger alerts when they appear in outbound requests.
The findings align with earlier reports on poisoned MCP tool descriptions and Agentjacking attacks that trick AI coding agents into executing malicious actions.

