The Model Context Protocol (MCP) standardizes tool use for LLM-based agents and enable third-party servers. This openness introduces a security misalignment: agents implicitly trust tools exposed by potentially untrusted MCP servers. However, despite its excellent utility, existing agents typically offer limited validation for third-party MCP servers. As a result, agents remain vulnerable to MCP-based attacks that exploit the misalignment between agents and servers throughout the tool invocation lifecycle. In this paper, we propose MCPShield as a plug-in security cognition layer that mitigates this misalignment and ensures agent security when invoking MCP-based tools. Drawing inspiration from human experience-driven tool validation, MCPShield assists agent forms security cognition with metadata-guided probing before invocation. Our method constrains execution within controlled boundaries while cognizing runtime events, and subsequently updates security cognition by reasoning over historical traces after invocation, building on human post-use reflection on tool behavior. Experiments demonstrate that MCPShield exhibits strong generalization in defending against six novel MCP-based attack scenarios across six widely used agentic LLMs, while avoiding false positives on benign servers and incurring low deployment overhead. Overall, our work provides a practical and robust security safeguard for MCP-based tool invocation in open agent ecosystems.


翻译:模型上下文协议(MCP)为基于大语言模型的代理工具使用提供了标准化框架,并支持第三方服务器接入。这种开放性引入了一种安全错位问题:代理会隐式信任可能不可信的MCP服务器所暴露的工具。然而,尽管现有代理具有出色的实用性,它们通常对第三方MCP服务器提供的验证机制有限。因此,代理在整个工具调用生命周期中容易受到基于MCP的攻击,这些攻击利用了代理与服务器之间的安全错位。本文提出MCPShield作为一个插件式安全认知层,旨在缓解这种错位并确保代理在调用基于MCP的工具时的安全性。借鉴人类经验驱动的工具验证思想,MCPShield通过元数据引导的调用前探测,协助代理形成安全认知。我们的方法在执行过程中将操作约束在受控边界内,同时感知运行时事件,并在调用后基于人类对工具行为的后验反思机制,通过对历史轨迹的推理来更新安全认知。实验表明,MCPShield在防御六种广泛使用的智能体大语言模型上的六种新型基于MCP的攻击场景时表现出强大的泛化能力,同时能避免对良性服务器产生误报,且部署开销较低。总体而言,我们的工作为开放代理生态系统中基于MCP的工具调用提供了实用且鲁棒的安全保障机制。

0
下载
关闭预览

相关内容

可靠且负责任的基础模型:全面综述
专知会员服务
20+阅读 · 2月10日
大型语言模型代理的安全与隐私综述
专知会员服务
30+阅读 · 2024年8月5日
使用tinc构建full mesh结构的VPN
运维帮
68+阅读 · 2018年12月1日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
BES:让语言模型通过双向进化搜索自我改进
专知会员服务
0+阅读 · 36分钟前
以色列-美国-伊朗战争中的无人机:关键要点
专知会员服务
3+阅读 · 今天14:04
《Palantir任务保障性软件安全标准(MA-S2)》
专知会员服务
6+阅读 · 今天13:49
基于声学的无人机检测技术综述
专知会员服务
5+阅读 · 今天13:37
《当代混合战争分析框架:俄乌战争经验教训》
专知会员服务
5+阅读 · 今天13:11
战略前沿人工智能的再思考(中文)
专知会员服务
7+阅读 · 5月29日
《量化地基防空系统间接效应的博弈论方法》
专知会员服务
5+阅读 · 5月29日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员