Skip to main content
NOV 2026 Latest guide updates. Latest: AI Design Patterns Local vs cloud AI Grill me Changelog →
C08 Intermediate Design

Attack Surface & Threats

Understanding the attack vectors specific to Claude Code

PDF editions Β· Guide v3.44.1 Β· Updated

The 4 main vectors

Claude Code is an agent with access to the filesystem, Bash commands, and the internet. Its attack surface is broader than a simple text assistant.

Vector 1: Prompt injection via external content. When Claude reads an email, a GitHub issue, or an analyzed file containing malicious instructions, it may execute them. The attack exploits the confusion between data and instructions.

Vector 2: Secret exfiltration via Bash. If permissions are too broad, a malicious prompt can ask Claude to read .env, SSH keys, or locally stored tokens, then exfiltrate via an HTTP request.

Vector 3: Supply chain via malicious skills and plugins. A Snyk study (ToxicSkills, 2026) on 3,984 skills found 36.8% of skills with security flaws, including 534 with critical risk. The β€œrug pull” is the most insidious variant: a legitimate MCP that becomes malicious after being approved.

Vector 4: Privilege escalation in multi-agent pipelines. In an orchestration, a compromised agent can pass malicious instructions to subsequent agents. The outputs of one agent become the inputs of the next without intermediate validation.

Quick risk matrix

ScenarioRiskImmediate action
Solo dev, public reposMediumInstall an output-scanner hook
Team, sensitive codebaseHighMCP vetting + injection hooks
Enterprise, productionCriticalLeast privilege, isolation and integrity verification

CVEs to know (selection 2025-2026)

CVESeveritySummary
CVE-2025-53109/53110HighSandbox escape filesystem MCP
CVE-2025-54135HighRCE via prompt injection in Cursor
ADVISORY-CC-2026-001HighSandbox bypass, patch v2.1.34+
ADVISORY-CC-2026-002MediumDeny rules silently dropped past 50 subcommands, patch v2.1.90+
CVE-2026-0755Critical (9.8)RCE in gemini-mcp-tool (no patch)

Immediate action if you are on v2.1.33 or earlier: update to v2.1.34+ to fix the sandbox bypass.

Defense in depth

The principle is simple: each layer reduces the probability that an attack succeeds.

Minimal permissions (settings.json)
+ Tool whitelist per task
+ Reading MCPs before installation
+ JSONL logs for post-incident detection
+ Sandbox / ephemeral environment

Basic permissions rule: grant only what the task requires. For a read/analysis task, restrict the agent with tools: Read, Grep, Glob or CLI --tools "Read,Grep,Glob". An allow rule only pre-approves a tool; it does not remove other tools.

Audit with JSONL logs

Claude Code writes all its tool calls to the session JSONL file, ~/.claude/projects/{encoded-path}/{session-id}.jsonl. These logs allow detecting abnormal behavior after the fact: unexpected reads of sensitive files, unplanned network calls, modification attempts outside scope.

Terminal window
# Inspect tool calls from a session
cat ~/.claude/projects/*/*.jsonl | jq '.message.content[]?.name // empty'

Enter your email to read the full card and get the complete PDF bundle.

All content is free and open-source. We just ask for your email.

PDF: