Skip to content

7.10 Known and Practical Attack Vectors in MCP Ecosystem

7.10.1 Tool poisoning attacks

Attackers embed hidden instructions within tool descriptions, invisible to users but readable by AI models. These concealed commands can prompt the AI to perform unauthorized actions, such as extracting sensitive data and transmitting it to malicious servers. For instance, a seemingly benign calculator tool might secretly instruct the AI to read confidential files and send their contents to an attacker-controlled endpoint.

7.10.2 Rug pulls: Silent redefinition

After initial approval, MCP tools can alter their definitions without notifying users. This creates a security risk where a tool that initially appears safe can later change its behavior, such as leaking API keys or executing harmful actions, without detection. This technique is not unique to MCP; it is also commonly exploited in other domains, such as browser extensions. For example, the LNKR malware campaign involved malicious updates to seemingly benign extensions, which turned them into adware or spyware after installation.

7.10.3 Cross-server tool shadowing

In environments with multiple servers, a malicious server can intercept or override calls intended for trusted servers. This “confused deputy” scenario enables attackers to manipulate legitimate tools by redirecting their operations through a malicious server, effectively hijacking the tool’s functionality.

7.10.4 ANSI escape code injection

Attackers can use ANSI terminal escape codes to hide malicious instructions in MCP tool descriptions and outputs, making them invisible on the screen while still being processed by the AI model. This technique leverages the line-jumping vulnerability to deceive even security-aware users further. In tests with Claude Code, no filtering or sanitization for tool descriptions containing ANSI escape sequences has been found. This allows attackers to launch supply chain attacks by injecting hidden suggestions to download packages from malicious servers, planting backdoors in dependencies, or manipulating development environments without users noticing.

7.10.5 Session hijacking in multi-server MCP setups

In environments with multiple stateful MCP servers, stolen session IDs can be exploited to inject malicious prompts or impersonate legitimate clients. An attacker can craft events using a hijacked session ID and target a different server that shares a queue or session store. This allows the malicious payload to be delivered to the original client, triggering unintended behavior. If the server does not enforce strict session validation, attackers can also use the stolen ID to make unauthorized tool calls or data access requests, bypassing authentication and gaining control over active sessions.

7.10.6 Typosquatting in public registries

Attackers may register MCP tools or servers with names similar to legitimate ones (e.g., file-summary-tool vs. file-summarizer). Because there is no strict identity verification or signature validation in MCP’s standard, users or applications may unknowingly connect to or authorize malicious tools, especially if using automated discovery or registries with lax trust models.

7.10.7 Tool supply chain attacks

MCP tools often depend on third-party packages or external APIs. Attackers can compromise the supply chain by injecting malicious code into dependencies or hosting malicious versions of common tools on registries. Because MCP lacks signature verification or integrity enforcement, compromised tool packages can be silently pulled and executed by clients, leading to persistent compromise, data exfiltration, or lateral movement within environments.