Tools and plugins you did not write — study guide

The concept's fragments, read in order.

Two things arrive with every tool

a tool you did not write brings text and code third-party tool package, plugin or tool server its text its code the model's input your instructions the conversation tool definitions someone else wrote read as prompt model picks and fills calls a running process on your machine or on someone else's server acts with what it was given files, network, credentials, data one source, two kinds of trust: untrusted instructions and untrusted code
One third-party tool splits into two paths: its definition text joins the model's input beside your own instructions and is read as prompt text, while its code runs as a process that acts with whatever files, network and credentials it has been given, so the same outside source supplies both untrusted instructions and untrusted code.

Agents rarely run only tools their builders wrote. A tool comes from a library, a plugin installed into an agent program, a skill or extension from a plugin marketplace, or a tool server: a separate program that offers tools to any agent that connects to it, using a protocol for connecting agents to tool servers. Package management carries the uncomfortable part: every dependency is code you will run but did not write, so each install extends your trust to everyone upstream. A tool goes one step further. It brings two things with it, and both come from someone else, like a contractor who arrives with their own power tools, which run on your wiring inside your house, and a page of written instructions your staff will read and follow as if you had written them.

The first is code. The controller (the program that starts the agent, holds the credentials, runs the checks and decides what happens next) decides whether a requested call runs, but the code that then runs is someone else's: in a process on your machine, acting with whatever access it has been handed, or on someone else's server, receiving whatever the agent sends it. The protocol's own specification says plainly that tools represent arbitrary code execution and must be treated with caution. The second is text. A tool's definition, its name, its description and the descriptions of its parameters, travels to the model as part of its input on every request where the tool is offered, and the model reads it the way it reads the rest of the prompt. So a tool you did not write is untrusted code and untrusted instructions at the same time, and the defenses for one do not cover the other.

The attacks follow from those two halves: instructions planted in a description or a result, a tool that looks like one you trust, a package name the model invented and a stranger registered, a tool that changes after you approved it, and a tool that asks for far more access than its job needs. The defenses are the ones this concept builds: an explicit allowlist where absence means refusal, pinning to an exact version and approving again on any change, reading a definition the way you would review a prompt, running each tool with the least access that works, and never accepting a component's own word that it enforces a restriction.

Its code runs with your agent's reach

A third-party tool is a program, and a program can do whatever its access allows, not just what its description says. A tool server that runs on your own machine is started by a command in a configuration file, and the protocol specification for tool servers warns that such a local server runs with the same privileges as the client that launched it. If that client runs as you, the server can read what you can read, your home directory and your SSH keys among it. Configuring a new local server is running someone's command. A remote tool server never touches your machine, but every argument your agent sends it arrives on someone else's computer, along with any file contents or records the agent was asked to pass along.

So the question to ask of each tool is how much it needs, and whether it asks for more. OWASP's guidance for language-model applications (2025) gives the shape of the problem: a third-party extension chosen only to read documents that can also modify and delete them, or an extension meant to run one specific command that lets other commands through. The protocol's own security advice lists the same habit from the access side as a common mistake: wildcard scopes, and unrelated privileges bundled together to spare the user later prompts. A tool that asks for broad access up front is telling you how large its blast radius will be if it is malicious, compromised or simply buggy.

The defense is the least access that works. Run each third-party tool in a sandbox (the contained environment its commands run in) that starts with minimal privileges, and grant the specific directories or network destinations it needs explicitly. Give it a credential of its own scoped to its job, never the agent's whole environment, and never a credential the controller holds for something else. Building that sandbox, and keeping secrets out of reach inside it, are subjects of their own. Least access does not make a tool trustworthy: whatever you grant it, it can misuse. What it does is decide in advance how bad that misuse can get.

Someone else wrote part of your prompt

the person approves a summary; the model reads every word one tool definition, as written name and first line Adds two numbers. rest of the description long text a screen may cut or never display planted instruction phrased as guidance for the model, about this tool or another one summary only approval screen a person sees: Adds two numbers. looks harmless, gets approved all of it the model's input every field, on every request where the tool is offered, planted instruction included review the full text the model receives, not the summary a screen shows
One tool definition reaches two readers differently: the approval screen a person sees shows only a short summary, while the model's input receives the whole text, including a planted instruction further down, so approving the summary does not mean approving what the model reads.

A tool definition is not documentation for a person. Its name, description and parameter descriptions travel with the request as part of the model's input, and the model decides which tool to call, and how, by reading them. So a definition you did not write is prompt text you did not write. Prompt injection is text a model treats as an instruction when the builder meant it as data, and a tool description is an unusually good place to plant some: it is in front of the model on every request where the tool is offered, whether or not the tool is ever called.

Security researchers named this tool poisoning in April 2025, describing instructions embedded in tool descriptions that are invisible to users but visible to the model, because the interface people approve tools in typically shows a shortened summary while the model receives the whole text. The same disclosure, and OWASP's later guidance for tool servers, described a related move: a description in one server's tool that changes how the agent uses a different, trusted tool from another server, so the planted text does its work through a tool you approved. The approval screen and the model's input are two different views of one definition, like a supplier's contract whose fine print your assistant reads in full and carries out, while the person who approved it read only the headline.

Results are the second channel. Whatever a third-party tool returns is written by its author, or by whoever wrote the page or record it fetched, and OWASP's advice is to treat every tool response as untrusted data, including responses from approved servers. What a tool returns gets no more authority than what a stranger typed, and the stranger in this case also wrote the description.

So review a third-party definition the way you would review a prompt someone handed you. Read every field the model will receive, not the summary a screen displays. Store the exact text you reviewed, so a later change shows up as a difference rather than slipping by. Refuse a description that refers to other tools or tells the model what to do beyond its own job. Review catches what is in the text today; it does not stop instructions arriving later in results, which is why limiting what the agent can do still carries the weight.

A name that looks like one you trust

A model picks a tool by reading names and descriptions, so a tool can win by looking right. An agent connected to several tool servers sees one combined list, and nothing in that list says which server is the careful one. At the time of writing (2026), the protocol specification for tool servers asks only that tool names be unique within a server, so two connected servers can offer tools with the same name, or with names that differ by one character. A tool that copies the name of one you rely on, or describes itself a little more broadly so it looks like the better fit for more requests, can be chosen in its place, and from then on it receives the arguments, and the data in them, meant for the real one.

This is not only a theoretical worry. A 2025 study crafted tool descriptions designed to be picked and inserted them among an agent's available tools; the crafted tools were selected far more often than earlier injection techniques managed, and the defenses the authors tested were insufficient against them. At the package level the same trick is old: one malicious tool-server package reported in September 2025 was a faithful copy of an official project, published under that project's name by someone else.

The defense is to decide identity in code, not by appearance. The controller resolves each tool to a fully specified identity that it chose in advance: which server or package, which exact version, which tool name on it. It is matched against the allowlist by that identity, never looked up by whatever name happens to answer. A name that appears on two connected servers is a collision to refuse, not a choice for the model to make. And a description that claims more than its tool's job, or that mentions other tools at all, is a reason to look harder before approving it rather than a sign of a helpful tool.

Names the model makes up

A coding agent pulls in dependencies as well as tools, and it chooses them by name. Sometimes the name is one the model made up. The code looks normal, an import line or an install command for a package that sounds exactly right, and the package does not exist. That alone would only cause a failed install. The danger is that anyone can publish a package under a free name in a public registry, so a name a model keeps inventing is a name an attacker can register and fill with code of their choosing. The researchers who measured this describe it as a variation of the classic package-confusion attack, made possible by models that write code.

The measurement is one large study published in 2025. It used sixteen commercial and open-weight models to generate 576,000 code samples in Python and JavaScript, and of the 2.23 million packages they recommended, 440,445, or 19.7 percent, did not exist. That is about a fifth, and it is one study's figure: the average was at least 5.2 percent for the commercial models and 21.7 percent for the open-weight ones, and the rate climbed steeply at high sampling temperatures (the setting that controls how random the output is). What makes it exploitable is repetition. When the researchers reran 500 prompts that had produced an invented name ten times each, 43 percent of the invented names came back in all ten runs, 39 percent never came back, and 58 percent came back more than once. In a 2024 report, one security researcher described publishing an empty, harmless package under a name models kept inventing, and claimed more than 15,000 downloads in about three months.

Checking that a package exists is a good first check and is not enough on its own, because once an attacker has registered the name, it exists. Ask whether this is the package you meant: who publishes it, how long it has existed, whether your project already depends on it. Better still, do not let the agent add dependencies on its own. In one real system, agents may not add dependencies during a build at all. Treat a new package as a change a person approves and pins in the lockfile like any other, not as something an agent installs because a model wrote its name.

Approved once is not approved forever

an approval covers exact bytes, checked before every launch approval record exact version, your own copy hash of the code hash of the full definition at launch time the code on disk now the definitions the tool sends now recorded hashed controller compares both hashes both match either differs launch the approved tool refuse raise a new approval; never upgrade silently an update, a changed definition or a swapped package all land on the refuse side
An approval records the exact version plus a hash of the tool's code and a hash of its full definition; before every launch the controller hashes what is installed and what the tool now sends and compares both with the record, a match launches the tool, and any difference is refused and raises a new approval instead of upgrading silently.

An approval is a decision about one specific thing. A third-party tool can stop being that thing without anyone deciding anything. A package publishes a new release and an automatic update installs it. A tool server sends a different list of definitions the next time it is asked; the protocol specification for tool servers includes a notification that exists to tell a client its list of tools has changed. OWASP's guidance for tool servers names the failure directly: a server changes its tool definitions after the user approved them, turning a trusted tool malicious, so do not assume a tool approved yesterday is the same tool today, like signing a contract kept in a shared document that the other party can keep editing after you sign, unless you kept a copy of the exact version you agreed to.

A clean record is no protection. In September 2025, security researchers reported a tool-server package that copied an official project, published under that project's name by someone else. Its first releases behaved normally. Then a new release added a single line that sent a hidden copy of every email the tool handled to an outside address. Anyone whose setup took the newest release received it without a decision. The agent runtime itself is in the same position.

Field recordIn one real system, the coding agent's built-in updater changed its version overnight, and its installer prunes old versions. The fix was for the controller to copy the version it had tested into its own directory, run only that copy, check its hash before every launch, and disable automatic updates in the agent's environment, while leaving the operator's own installation alone.

The same defense fits every tool: pin and compare. Approve an exact version, keep your own copy of it rather than pointing at whatever the publisher currently serves, record a hash (a fingerprint of the exact bytes) of the code and a separate hash of the full definition text, and check both before every launch. A match launches; a mismatch is refused and becomes a new approval, never a silent upgrade. Both hashes matter, because a definition can stay word for word identical while the code behind it changes. A remote tool server limits what you can pin to what it sends you, its definitions; the code behind them runs on someone else's machine and can change at any time, which is one more reason to give it little to work with. Binding trust to exact versions in depth, and testing a new version before trusting it, belong to qualifying agents, a subject of its own.

Absence refuses

leaving a tool off a list only refuses it if absence means refusal a pre-approval list skips the prompt for listed tools an allowlist anything not listed is refused listed tool that asks call runs without asking unlisted tool that asks call a person is asked unlisted tool that never asks call runs anyway: the list never applies listed tool that asks call may run unlisted tool that asks call refused unlisted tool that never asks call refused then prove the tools actually available are a subset of the approved ones, by an inventory or by a test that tries an unlisted tool
Two lists compared on the same three tools: a pre-approval list only skips the permission prompt for listed tools, so an unlisted tool that never asks permission runs anyway, while a true allowlist refuses every tool not on it, including the one that never asks.

The list that decides which tools an agent may use has to work in one direction only: a tool on the list may run, and a tool not on the list is refused. That sounds like what any list called an allowlist does. It is not always what it does, and the gap is easy to miss because the names of permission settings describe what their authors intended rather than what the code enforces.

Field recordIn one real system, leaving a sub-agent tool off a run's allowlist denied nothing, because that list only pre-approved tools that would otherwise ask for permission and this tool never asked, and only an explicit deny made it unavailable; the page on the controller's authority tells that story in full. A later review found a skill-loading tool that nobody had requested still passing under the deny-list approach, which is what a deny list does: it stops only the names someone thought to write down.

Field recordSeparately, the same system once handled trust as special cases for one named runtime, so any other runtime fell through to a default path that carried maximum trust; a newly added one landed at maximum trust by omission. The page on qualifying an agent before you trust it tells that one in full.

What changed was the shape of the rule. Trust became a table the controller owns, and a component that is not in it is refused for unattended work, like a door that opens only for badges registered at the front desk in advance, so a badge nobody registered does nothing, however official it looks. A component never declares its own trust level. The tools actually available in a run must be a subset of the tools that were approved, and that has to be established, not assumed: from an inventory of what the runtime offers, or from a test in which the agent is told to use an unlisted tool and is seen to be unable to. No inventory and no test means refusal. Adding a tool is a deliberate entry a person makes, backed by evidence, and absence never grants anything.

A component's word is not a control

Many tools and agent runtimes come with restrictions of their own: a permission setting, a read-only flag, an annotation that says a tool only reads. Each of these is the component telling you what it will do. That is a claim, and a claim is something a component says, not something the controller observed. The protocol specification for tool servers says as much about its own security principles: it cannot enforce them at the protocol level, and descriptions of tool behavior are to be treated as untrusted unless they come from a trusted server.

Field recordIn one real system, an integration with a coding agent passed a rules file, meant to restrict the agent, through a generic configuration flag. That flag silently accepts keys it does not recognize, and "rules file" was not a real setting, so the restriction did nothing. Meanwhile the agent's child process received every credential the caller held, and the integration's 567 tests, run against a fake agent rather than the real one, were green; the page on qualifying an agent before you trust it tells that half of the incident, and what probing the real program found, in full. An external review found the enforcement was a no-op on the same day the release shipped. Further findings were of the same kind: a flag meant to switch a feature off, written in the generic form, was silently absorbed, while the dedicated disable flag fails loudly on names it does not know; and an environment variable claiming the network was disabled turned out not to be proof that it was.

What changed was where the guarantee lives. Containment replaced restriction: an exact list of the credentials a run may receive, checks the controller runs after every run, and disposable workspaces. A policy the controller cannot enforce is refused before anything is spent, never silently dropped. The successor system goes further and switches off the coding agent's own inner sandbox, with the flag its help text reserves for running inside an external sandbox, and relies on the outer one it controls. Any hardening flag is proven by observation, running the runtime's feature list under the exact launch arguments, and a disable that does not take effect fails qualification. The rule written down afterward: never assert a provider capability without running its features list. Testing that a restriction really holds, with a working control beside it, is the business of qualifying agents.

Even containment has stated limits. Revoking one environment token does not prove every route to a credential is closed, and checking the repository's references after a run does not undo every side effect it may have had.

Know exactly what your agent depends on

Running a coding agent you do not have to trust means distrusting more than the model. The agent runtime is software someone else wrote and updates on its own schedule. The tool servers it connects to, the plugins it loads and the packages it installs are more of the same. Each one brings code that runs with some share of the agent's reach and, if it offers tools, text the model will read as instructions. A controller that checks every action the agent proposes still faces proposals a planted description shaped, and it will allow any of them that fall inside the agent's grants.

So treat adding a tool the way you would treat letting a stranger into the workshop. Keep an explicit allowlist that the controller owns, where a tool that is not listed is refused and the tools actually available are shown to be a subset of the approved ones. Pin each one to an exact version, keep your own copy, compare the hashes of its code and its definition before every launch, and treat any change as a new approval. Read its definition as the prompt text it is. Run it with the least access that works, in a sandbox, with a credential of its own. And accept no component's word that it enforces a restriction; believe the containment you control and the checks you ran yourself.

None of this makes a third-party tool safe. A pinned, reviewed, sandboxed tool can still return text that steers the model, and least access only bounds what a misbehaving tool can reach. What these habits buy is narrower and more useful: you know exactly which outside code and outside text your agent depends on, nothing joins that set without a decision, and nothing you can pin changes without you noticing. For an agent you intend to leave running on real work, that is the difference between a supply chain and a pile of things that happened to be installed.

Sources

The published studies, standards and guidance this page cites. Links open on other sites. Field records come from the author's own records and have no public source.

  1. Model Context Protocol Specification, version 2025-11-25 modelcontextprotocol.io
  2. LLM06:2025 Excessive Agency (OWASP Gen AI Security Project) genai.owasp.org
  3. MCP Security Notification: Tool Poisoning Attacks (Invariant Labs, 2025) invariantlabs.ai
  4. MCP (Model Context Protocol) Security Cheat Sheet (OWASP Cheat Sheet Series) cheatsheetseries.owasp.org
  5. Prompt Injection Attack to Tool Selection in LLM Agents (arXiv, 2025) arxiv.org
  6. Unofficial Postmark MCP npm silently stole users' emails (BleepingComputer, 2025) www.bleepingcomputer.com
  7. We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs (USENIX Security 2025) www.usenix.org
  8. AI bots hallucinate software packages and devs download them (The Register, 2024) www.theregister.com