SemFW 代理为 MCP 工具调用绑定任务意图,防提示注入攻击
Right Intent, Malicious Action: Intent-Bound Authorization for Model Context Protocol Tool Calls
做 Agent 或接 MCP 的开发者都该看看这篇:工具结果里藏的恶意指令能让授权内的工具干坏事,MCP 自带授权根本管不住。SemFW 用 passport 加本地模型审核,攻击成功率从 100% 压到 4.2%,误报也压到了 6.9%,比之前两种防御更平衡。
一篇 arXiv 论文提出 SemFW,一个 MCP 代理,把每次工具调用绑定到用户的具体任务上。流程是:可信签发方为每个任务签署一份 passport,列出允许调用的工具和资源;SemFW 拒绝 passport 之外的任何调用,用本地模型(inspector)判断剩余调用是否服务于任务,并把高风险调用转交人工确认。
在固定测试语料上,passport 检查拦截了全部已测的范围与资源越权;inspector 把范围内误用攻击的成功率从 100% 降到最高 4.2%,同时放行了 85.3%-88.2% 的正常调用。在 AgentDojo 基准的多步会话中,Gemma inspector 的误报率从 32.4% 降到 6.9%,关键在于代理追踪了目标参数的来源。作者还用 Tamarin 协议验证器给出形式化证明,指出标准的 proof-of-possession 因不覆盖请求体,可让被观测到的凭证授权另一个不同的调用。
论文指出现有 MCP 授权在签发 token 时决定可调用的工具,完全看不到用户任务,因此挡不住藏在工具结果里的恶意指令。两种已有防御要么过严要么过宽,SemFW 走的是协议边界的路线,可与模型层防御互补,但 passport 是否会阻碍正常任务完成尚未验证。
Right Intent, Malicious Action: Intent-Bound Authorization for Model Context Protocol Tool Calls
An LLM agent that follows instructions hidden in a tool result can misuse a tool it is authorized to call. Model Context Protocol (MCP) authorization does not prevent this, because it decides at token issuance which tools a client may call and never sees the task the user asked for. We bind each call to that task. A trusted issuer signs a per-task passport listing the permitted tools and resources; SemFW, an MCP proxy, rejects any call outside the passport, asks a local model, the inspector, whether the remaining calls serve the task, and sends flagged high-risk calls to an authenticated human. On a fixed corpus, the passport checks stopped every tested scope and resource escalation, and the inspector cut attack success on in-scope misuse from 100% to at most 4.2% while passing 85.3-88.2% of benign calls. Two prior defenses were either too strict or too permissive. In multi-step sessions from the AgentDojo benchmark, the Gemma inspector's false alarms fell from 32.4% to 6.9% once the proxy tracked where destination arguments came from. A model in the Tamarin protocol verifier proves authenticated issuance, confinement and approval integrity for an issued passport, and shows that a standard proof of possession, which does not cover the request body, lets an observed proof authorize a different call. Checking calls against the task at the protocol boundary can thus complement model-level defenses, provided the policy is correct. Whether issued passports let agents finish clean tasks is still untested.
This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include MCP and tools, agents, AI safety, AgentDojo.
Source attribution: curated from arXiv cs.AI (@Ridwan Amure, Precious Sanni).