跳到正文
DEV Community· Agentic Affairs·· 58 分鐘前AI 評分63

智能體工具使用漏洞:工具存取如何改變智能體安全

Agent Tool-Use Vulnerabilities: How Tool Access Changes an Agent's Security

AI 導讀

Agentic Affairs 分析指出,智能體取得工具存取權後,工具輸出可能成為注入指令,令模型把提示注入轉化為對外部系統的操作風險。OWASP 2025 年 12 月的《Top 10 for Agentic Applications》列出 ASI01、ASI02、ASI03 及 ASI06 等風險;文章亦提及惡意 MCP 伺服器可透過工具描述注入指令。

正文

Agent Tool-Use Vulnerabilities: How Tool Access Changes an Agent's Security

Giving your agent a tool isn't adding a feature — it's handing a stranger your keys and trusting that the instructions hiding in the data won't talk it into using them. The moment a model can act instead of just answer, every tool result becomes a possible instruction, and every permission you forgot to scope becomes someone else's weapon.

The loop is the attack surface

An agent isn't a chatbot with extras. It's a loop: the model picks a tool, code outside the model runs it against a real system, and the result lands back in the model's context as new input. A workflow has a human deciding what happens next. An agent lets the model decide — step by step, based on whatever it just read. That handoff between probabilistic text and deterministic action is where the security model breaks.

Prompt injection doesn't need to talk to your model

The most consequential attack never touches your model directly. Attackers plant prompts in the data the agent is supposed to read — a web page, a document, a search result, an email — and the application processes it as part of its normal work. Greshake and colleagues showed retrieved prompts acting as arbitrary code execution in effect: steering the app into calling APIs the user never asked for, stealing data, even worming through the information ecosystem. OWASP's December 2025 Top 10 for Agentic Applications names this ASI01 Agent Goal Hijack, citing EchoLeak — hidden prompts turning copilots into silent exfiltration engines.

Excessive authority turns a hijack into a disaster

A hijacked goal is bad. A hijacked goal executed with broad credentials across production systems is much worse. OWASP calls it ASI02 Tool Misuse and ASI03 Identity and Privilege Abuse: the agent is a legitimate deputy, using legitimate tools in legitimate ways — for a goal the user never set. Individual calls look entirely normal. That's the point. And authority accumulates silently: credentials stay available in later steps unless you scope or revoke them. The sharpest risk is irreversible actions — deleting records, moving money, messaging customers, modifying code.

Data leaks through chains, not single calls

Exfiltration doesn't need to break anything, which is why it runs unnoticed. One tool legitimately retrieves an internal record; a second legitimately sends a message to an external system. Neither call is suspicious. The vulnerability is in the chain. Sensitive material also rides along in tool arguments, or gets embedded in context where it steers later calls. And poisoned state — OWASP's ASI06 — means a stored note carrying an injected instruction reshapes behaviour on every later run.

Your MCP server is a trust decision, not a dependency

The supply chain is the third entry point, and MCP is the clearest example. The model picks tools based on descriptions written by the server's developers. In April 2025, Trail of Bits showed a malicious MCP server attacking a user before any tool was called — instructions hidden in the tool descriptions themselves. By November 2025, researchers had reportedly pulled an entire WhatsApp message history out of an agent through a poisoned MCP integration. Every plugin, prompt template, and registry you load at runtime is a trust decision.

The defences that actually help

  • Least privilege, per task. The agent gets only the tools and permissions the current task requires. Nothing else.
  • Human approval before irreversible action. Claude Code's read-only-by-default model is the shape: ask a human before modifying code or systems.
  • Deterministic gates in code, not in the prompt. A system-prompt sentence asking the model to check first is not a gate. A policy check in the execution path — allow, ask a human, deny — runs whatever the model decides.
  • Log every tool call. A chained attack leaves a trace a person can inspect — if you record the arguments, the result, and the decision that approved it.

The honest boundary: nobody in the sources consulted has measured success rates for these defences against indirect prompt injection in production. They're risk reduction, not a guarantee. Keep human review mandatory for the highest-stakes actions — and run the checklist before shipping: list every tool and its worst case, gate the irreversible calls in code, test with adversarial material, trace the data flows, audit the supply chain, and confirm you can stop the agent mid-run without losing the record.

Go deeper

Read the full explainer on Agentic Affairs: Agent Tool-Use Vulnerabilities: How Tool Access Changes an Agent's Security

Originally published on Agentic Affairs (https://agentic-affairs.com)

來源:DEV Community · dev.to