Security and Governance: Prompt Injection in Tool Descriptions, the Confused Deputy, Least Privilege, Audit Logs, and a Tool Allowlist
Treat MCP as an entry point for untrusted input: what can go wrong in tool descriptions, tool results, state handles, tokens, and local servers, plus a checklist you can tick off item by item.
Today's Goals
- Explain why both tool descriptions and tool results count as untrusted input, and give one defense for each
- Explain what causes the confused-deputy problem and token passthrough, and state what the spec requires instead
- Scope a server's authorization by least privilege, and design an auditable call log
Finishing the client yesterday, you brushed against one sentence: a client must treat tool annotations as untrusted input. Today pushes that sentence to its conclusion. Come back and tick off the three goals above.
Plain-Language Walkthrough
Think of MCP as an entry point
Back to the adapter metaphor, from a new angle today: a socket is an entry point. You cut a hole in your wall permitting a device you did not build, did not audit, and which may have updated yesterday to plug in and draw power.
The first step in reviewing an entry point is not listing vulnerabilities but asking: what on this entry point is outside my control?
Five answers, each more surprising than the last:
| The untrusted thing | Who wrote it | Worst case |
|---|---|---|
| Tool descriptions and annotations | The server's author | Text disguised as a system prompt entering the model's context |
| Tool results | The server, or upstream data the server read | The same, updated more often and harder to audit |
| State handles and request state | Nominally signed by the server, but passing through the client | Rewritten, replayed, or used to reach somebody else's data |
| Tokens | Signed by the authorization server, handed over by the client | A token from elsewhere accepted, or forwarded downstream by the server |
| A local server's launch command | A configuration file, possibly from a one-click install | Arbitrary code execution with the same privileges as your client |
Most people defend only the fourth, because that is traditional security's turf. The first two are MCP's own: they look like documentation and are in fact input the model reads as instructions. Today's center of gravity is there.
Interview questions
Why is an MCP tool's description untrusted input, and what protections would you build as a client author?为什么说 MCP 工具的描述是不可信输入?作为客户端作者,你会做哪些防护?
Common in ChinaCommon overseasIntermediate#prompt-injection#client🔒 Unlock this chapter to see the answer keys.
How does the confused deputy attack play out in an MCP setting, and what does the spec require to prevent it?混淆代理攻击在 MCP 场景里具体是怎么发生的?规范要求怎么防?
Common in ChinaCommon overseasDeep dive#oauth#confused-deputy🔒 Unlock this chapter to see the answer keys.
Since the protocol is stateless, a server that needs state mints a handle for the client to carry back. What attack surface does that create, and how do you close it?2026-07-28 之后协议是无状态的,服务端要保存状态就得铸一个句柄让客户端带回来。这会带来什么新的攻击面?怎么防?
Common in ChinaCommon overseasIntermediate#statelessness#security🔒 Unlock this chapter to see the answer keys.
