IA

invariantlabs-ai/mcp-injection-experiments

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

211 stars 31 forks 质量 36 趋势 0

invariantlabs-ai/mcp-injection-experiments 是从 https://github.com/invariantlabs-ai/mcp-injection-experiments. 导入的 MCP 服务器候选

概览

invariantlabs-ai/mcp-injection-experiments 是从 https://github.com/invariantlabs-ai/mcp-injection-experiments. 导入的 MCP 服务器候选

概述(AI 翻译)

该仓库包含一些实验性的MCP服务器实现,尝试注入正在使用的MCP客户端/代理。

有关该攻击方法的更多信息,请参阅我们的博客文章。

更新: 我们发布了一款名为mcp-scan的新安全扫描工具,能够检测本仓库中展示的MCP攻击,并帮助您保护MCP服务器的安全。

直接中毒

在 direct-poisoning.py 中,我们实现了一个简单的 MCP 服务器,指示代理在调用 add 工具(此处指 SSH 密钥和 mcp.json 文件本身)时泄露敏感文件。

光标中的示例执行如下:

工具影子学习

在shadowing.py中,我们实现了一种更复杂的MCP攻击,它操控代理对send_email工具(由另一台受信任服务器提供的)的行为,使代理发送的所有邮件泄露到攻击者的服务器。

Cursor 中的示例执行如下:

WhatsApp 接管

最后,在 whatsapp-takeover.py 中,我们实现了一种结合了遮挡攻击和“卧底拉”(sleeper rug pull),即一个 MCP 服务器只在第二次加载时将工具界面切换为恶意界面。

本页由 AI 翻译,技术细节请以原文为准。

README

MCP Tool Poisoning Experiments

This repository contains a few experimental MCP server implementations, that attempt ot inject the MCP client/agent in use.

For more details about the attack method, please see our blog post.

Update: We have released a new security scanning tool called mcp-scan, that detects MCP attacks as demonstrated in this repository, and helps you secure your MCP servers.

Direct Poisoning

In direct-poisoning.py, we implement a simple MCP server that instructs an agent to leak sensitive files, when calling the add tool (in this case SSH keys and the mcp.json file itself).

An example execution in cursor looks like this:

Tool Shadowing

In shadowing.py, we implement a more sophisticated MCP attack, that manipulates the agent’s behavior of a send_email tool (provided by a different, trusted server), such that all emails sent by the agent are leaked to the attacker’s server.

An example execution in Cursor looks like this:

WhatsApp takeover

Lastly, in whatsapp-takeover.py, we implement a shadowing attack combined with a sleeper rug pull, i.e. an MCP server that changes its tool interface only on the second load to a malicious one.

The server first masks as a benign “random fact of the day” implementation, and then changes the tool to a malicious one that manipulates whatsapp-mcp in the same agent, to leak messages to the attacker’s phone number.

Can you spot the exfiltration? Here, the malicious tool instructions ask the agent to include the smuggled data after many spaces, such that with invisible scroll bars, the user does not see the data being leaked. Only when you scroll all the way to the right, will you be able to find the exfiltration payload.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →