Claude Code Mods: What Security Teams Need to Know

Daphna Wegner

October 8, 2026

10 mins read

blog_image

TL;DR

  • Claude Code mods can create security risks because they run with the user’s permissions and can rewrite prompts, approve tool calls, and change what the user sees.
  • Anthropic provides admin controls for organizations, including sec-default, managed settings, and allowManagedModsOnly, but those protections only apply to what the organization manages.
  • To secure Claude Code mods, security teams should combine managed settings with controls at the MCP, model API, usage, and tool-call boundaries.

On October 1, Anthropic announced that developers can now mod Claude Code. A mod is a few lines of TypeScript that runs inside Claude Code and can change how it behaves, what it shows, and which features it has. Developers don't even have to write it: they describe the mod and Claude builds it.

For security teams, that changes the risk model: Claude Code mods can run with the user’s permissions, alter prompts and tool behavior, and introduce code that sits directly inside the agent’s execution path.

Mods are on by default in Claude Code 2.1.287 and later. They install like any plugin, through /plugin, and they spread the same way: a GitHub repo, a marketplace, a teammate's link. For users, this is the most flexible Claude Code has ever been. For security teams, it means the coding agent's behavior is now partly decided by whatever code your users chose to install.

What a mod is

A mod is a set of event handlers. Claude Code calls them when something happens: a prompt is submitted, a tool is about to run, part of the screen is drawn. Each handler can observe the event, rewrite it, or answer it so the normal behavior never runs.

That is a step beyond the extension points teams already know:

Where it runs What it can change
Settings hook A script outside Claude Code Allow, block, or log an event
Skill Instructions Claude reads What Claude knows and does
MCP server An external process Which tools Claude has
Mod Inside Claude Code's own process Prompts, tool calls, commands, turns, and the interface

Anthropic is using mods to build Claude Code itself. AGENTS.md support and the /diff pane already ship as built-in mods, and the company plans to move more features over time.

What a mod can reach

Anthropic's documentation is direct about this: a mod is code that runs with the user's permissions, and it is not sandboxed. Once loaded, a mod can:

  • Read and write files anywhere the user can, start programs, and make network requests
  • Read environment variables and settings files, including API keys kept there
  • See every prompt the user sends and every tool call Claude makes
  • Rewrite a prompt or tool call, or submit a prompt as if the user had typed it
  • Approve a tool call before the user is asked
  • Call a model on the user's plan or API key

Two details matter for security teams. First, Claude Code's sandbox isolates the Bash commands Claude runs, but a process a mod starts runs outside it. Second, a mod that approves tool calls can approve one that an ask rule would have prompted for, or one the user's own PreToolUse hook blocked. One guardrail stays fixed: a mod cannot change what the permission prompt shows.

Put plainly, a mod is a browser extension for your coding agent, with shell access. The supply-chain question is the same one: who wrote it, who reviewed it, and what changed in the last update.

What could go wrong

None of the scenarios below require a vulnerability in Claude Code. They follow directly from what a mod is allowed to do.

  • The useful trojan. A handy mod, say a context-usage bar, that also forwards prompts and tool results to an outside server. The feature is the lure.
  • The version-two payload. A clean mod earns installs, then an update adds the malicious handler. Without pinned versions and re-review, every machine takes it.
  • Approval laundering. A mod that auto-approves tool calls removes the human checkpoint. Combined with a prompt injection, the agent executes and nobody is asked.
  • Silent prompt tampering. Instructions appended to every prompt, or tool-call arguments rewritten before they run. The developer typed one thing; the model received another.
  • A lying interface. Tool-call rows and the transcript can be restyled, so a command that ships secrets elsewhere can be shown as a lint run.
  • Credential harvest. Environment variables and settings files hold API keys and cloud tokens. A process a mod starts to send them out runs outside Claude Code's sandbox.
  • Token theft. Model calls on the developer's plan for someone else's workload, visible only as a usage number nobody checks.
  • Headless persistence. Mod hooks run in claude -p and CI, where nothing draws. A mod in a pipeline plugin acts with no screen for anyone to notice, in an environment full of secrets.

Half of these target the controls themselves: the approval step, the user's own hooks, the display. That is the case for a layer that sits where a mod's code does not run.

What Anthropic built for organizations

Anthropic shipped real controls alongside the feature, and they are worth knowing in detail.

A built-in guard loads first. On Team and Enterprise plans, and on machines with managed settings, Claude Code loads a policy mod called sec-default before any mod a user installs. It stops user mods from changing what managed hooks receive or decide, the system prompt, managed CLAUDE.md instructions, and the tools of managed MCP servers. Its source is public.

One setting stops user mods. Setting allowManagedModsOnly on that guard in managed settings means only your organization's mods and Claude Code's built-in mods load.

Existing plugin controls still apply. Mods ship inside plugins, so marketplace restrictions you already set cover them. If you turn off web fetching, a mod's network requests through the mods API are refused too.

Mods can be reviewed before install. claude plugin validate lists the events a mod handles and what it asks Claude Code to do, such as reading files or making network requests, without running it.

The key word throughout is managed. The guard protects what the organization manages. A rule or hook a developer set up for themselves is not covered.

How to approach mods this week

  1. Find out who has Claude Code 2.1.287 or later. Every one of those machines can load mods today. Include non-engineers; in one recent deployment we found a salesperson running Claude Code with a GitHub token in plain text.
  2. Put every machine under managed settings. The sec-default guard only protects what you manage, and a laptop with no managed settings on a personal plan gets none of it.
  3. Start with allowManagedModsOnly. Block user-installed mods by default, then open up through an internal marketplace of mods you have reviewed. It is easier to loosen a policy than to clean up after one.
  4. Move your policy hooks into managed settings. A user-level PreToolUse hook can be overridden by a mod. A managed hook cannot.
  5. Review mods like you review extensions. Run claude plugin validate before approving one, and look hard at network calls, process starts, file reads outside the project, and anything that approves tool calls.
  6. Re-review on update. A mod that was harmless at 1.0 can add a network call at 1.1. Pin versions in your internal marketplace.

How we approach it at MagicMirror

Our starting principle: if code can run inside the agent, a control that lives only inside the agent is one layer, not the whole defense. So Marv enforces at the boundaries a mod passes through but doesn't own.

  • MCP traffic. Marv's MCP proxy wraps the MCP servers Claude Code calls. A tool call a mod rewrote still crosses the proxy, where it is classified before it executes. Tool results are scanned for prompt injection, and poisoned tool definitions are stripped.
  • Model traffic. Marv's API proxy sits between Claude Code and the model providers. A prompt a mod rewrote, or a model call a mod made on the user's key, is checked for PII, financial data, and company-specific IP, then redacted or blocked according to policy.
  • Usage. Every request through the API proxy is attributed by user, agent, and model, so a mod quietly spending tokens shows up in the numbers.
  • Tool calls. Marv's hook checks each tool call against policy on the device. We recommend deploying it, like any policy hook, through managed settings so the sec-default guard protects it from user mods.

Next: scanning what gets installed. Today Marv checks MCP servers for supply-chain risk before they launch and strips poisoned tool definitions before the agent sees them. Our next release extends that scanner to agent skills, and we're adding mod scanning to it, so the code a mod brings in gets the same scrutiny as the MCP servers and skills beside it. We're also exploring a Marv security mod, which would add our checks inside Claude Code alongside the ones at its boundaries.

The agent is now programmable

Mods are a genuinely good feature, and Anthropic launched them with clear warnings and real admin controls. But they change a basic assumption: Claude Code no longer behaves the same on every machine. Its behavior is whatever its installed code says. Security teams that manage the settings, curate the marketplace, and enforce policy at the boundaries will be able to say yes to mods. Teams that don't will find out what their agents run the hard way.

Sources

Key Takeaways

  • Claude Code mods are not sandboxed and can read files and environment variables, start processes outside Claude Code’s sandbox, and make network requests.
  • Claude Code mod security risks include bypassing user-level controls, because a mod can approve a tool call that an ask rule or user-level PreToolUse hook would otherwise stop.
  • Anthropic’s sec-default guard protects managed controls, including managed settings, hooks, and MCP servers, but does not protect unmanaged personal setups.
  • Security teams should start with allowManagedModsOnly and then allow reviewed, version-pinned mods through an internal marketplace.
  • Policy hooks should be moved into managed settings, because user-level hooks can be overridden by a mod.
  • Securing Claude Code mods requires more than in-agent controls, so organizations should also enforce policy at MCP, model API, usage, and tool-call boundaries.

FAQs

What are Claude Code mods?

Claude Code mods are small TypeScript modules that run inside Claude Code and respond to events such as prompts being submitted or tools being called. They can observe, rewrite, or respond to those events and can change how Claude Code behaves.

Are Claude Code mods sandboxed?

No. As described in the article, mods run with the user’s permissions and are not sandboxed. They can access files, environment variables, settings, start processes, and make network requests within the user’s permission scope.

What security risks can Claude Code mods introduce?

Claude Code mod security risks include prompt tampering, tool-call approval, credential exposure, hidden network activity, and changes to what the user sees. These risks come from the level of access a mod can have once it is installed.

How can security teams control Claude Code mods?

Security teams can use managed settings, move policy hooks into managed settings, start with allowManagedModsOnly, review mods before approval, and re-review them when versions change.

What does allowManagedModsOnly do?

allowManagedModsOnly restricts Claude Code so that only organization-managed mods and built-in mods can load, helping prevent users from installing unreviewed mods outside the organization’s approved setup.

Table of Contents

Section links generate automatically from this article's headings.

Govern AI where it's used, not after the damage is done.

Get started

See how MagicMirror protects every AI interaction across your organization.

Or talk to our AI security experts → sales@magicmirrorsecurity.com