Skip to main content
Vulnerability Database/CVE-2026-96620

CVE-2026-96620: Claude Agent SDK Command Injection RCE Vulnerability

CVE-2026-96620 is a command injection flaw in Claude Agent SDK that allows attackers to execute arbitrary commands through malicious session IDs. This article covers the technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-96620 Overview

CVE-2026-96620 affects the Claude Agent SDK, a Python SDK for Claude Code published by Anthropic. The vulnerability allows attackers to inject arbitrary command-line flags into the underlying Claude CLI through the resume option. When an application passes untrusted input as the session ID to resume, a dash-leading value is parsed as an independent CLI flag rather than as the value of --resume. Attackers can inject --mcp-config to define a stdio Model Context Protocol (MCP) server, triggering arbitrary command execution at CLI startup outside the SDK permission controls. The issue is categorized under [CWE-20] Improper Input Validation and is fixed in version 0.2.121.

Critical Impact

Attackers who control the resume session ID input can achieve arbitrary command execution on the host running the Claude Agent SDK, bypassing SDK permission controls.

Affected Products

  • Anthropic Claude Agent SDK for Python prior to 0.2.121
  • Applications that pass untrusted input as the session ID to the resume option
  • Integrations invoking the Claude CLI via the SDK subprocess transport

Discovery Timeline

  • 2026-10-16 - CVE-2026-96620 published to NVD
  • 2026-10-21 - Last updated in NVD database

Technical Details for CVE-2026-96620

Vulnerability Analysis

The Claude Agent SDK invokes the Claude command-line interface as a subprocess, passing user-supplied options as argv tokens. In the vulnerable transport, the resume option was appended as two separate tokens: --resume followed by the user value. The CLI declares --resume as taking an optional value, so a value beginning with a dash is not bound to the flag. Instead, the argument parser treats it as a standalone flag.

An attacker who controls the session ID passed to resume can supply a value such as --mcp-config=/tmp/evil.json. The CLI interprets this as a request to load an MCP configuration file. MCP supports stdio servers, which are defined as arbitrary commands executed at CLI startup. The attacker-supplied configuration causes the CLI to spawn an attacker-chosen process before the SDK applies any permission checks.

Root Cause

The root cause is improper input validation of the resume and session_id options in src/claude_agent_sdk/_internal/transport/subprocess_cli.py. The SDK did not reject dash-leading values or bind values to flags using the --flag=value form, allowing untrusted input to escape its intended parameter position.

Attack Vector

Exploitation requires an application built on the Claude Agent SDK to accept untrusted input and pass it as the resume session ID. The attack is network-reachable where the hosting application exposes such an interface. No authentication or user interaction is required against the SDK itself. The payload leverages --mcp-config to define a stdio MCP server whose command is executed by the Claude CLI at startup.

python
         if self._options.continue_conversation:
             cmd.append("--continue")
 
+        # Pass these as --flag=value rather than as two argv tokens. The CLI
+        # declares --resume with an optional value, so in the two-token form a
+        # dash-leading value is not bound to the flag and is instead parsed as
+        # a separate CLI flag -- letting an untrusted value inject arbitrary
+        # flags. The equals form always binds the value to the flag.
         if self._options.resume:
-            cmd.extend(["--resume", self._options.resume])
+            cmd.append(f"--resume={self._options.resume}")
 
         if self._options.session_id:
-            cmd.extend(["--session-id", self._options.session_id])
+            cmd.append(f"--session-id={self._options.session_id}")
 
         # Handle settings and sandbox: merge sandbox into settings if both are provided
         settings_value = self._build_settings_value()

Source: GitHub Commit 347a1cb. The patch binds the user value to the flag using the --flag=value form, preventing argv-token injection.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2026-96620

Indicators of Compromise

  • Claude CLI invocations whose argv contains --mcp-config when the hosting application never configures MCP intentionally.
  • Unexpected child processes spawned by the Claude CLI shortly after startup, especially shells or interpreters.
  • Session ID or resume values logged by the application that begin with -- or contain =.

Detection Strategies

  • Audit application logs for resume or session_id inputs that start with a dash character.
  • Monitor process creation events where the parent is the Claude CLI and the child command does not match an approved MCP server allowlist.
  • Statically scan code for calls that forward HTTP request parameters or database values directly into the SDK resume option.

Monitoring Recommendations

  • Enable endpoint process telemetry to capture full command lines for the Claude CLI and its children.
  • Alert on new .json files written to world-writable paths that are later referenced by --mcp-config.
  • Track SDK version strings in deployment inventories to confirm all hosts run 0.2.121 or later.

How to Mitigate CVE-2026-96620

Immediate Actions Required

  • Upgrade the Claude Agent SDK to version 0.2.121 or later on all systems. See the GitHub Release v0.2.121.
  • Audit all code paths that supply the resume or session_id options with values derived from external input.
  • Reject session identifiers that do not conform to a strict allowlist pattern such as a UUID.

Patch Information

The fix is published in commit 347a1cb88d7652199399db1b7f914e0a459a6662 and merged via Pull Request #1123. Additional detail is available in the GitHub Security Advisory GHSA-h4mw-j7qp-8mwm. The patch changes the subprocess transport to pass --resume=<value> and --session-id=<value> as single argv tokens, binding the value to the flag.

Workarounds

  • Validate session IDs against a strict regular expression such as ^[A-Za-z0-9_-]{1,64}$ and reject any value beginning with -.
  • Refuse to invoke the SDK when the resume input originates from an untrusted boundary without server-side sanitization.
  • Restrict the execution environment of the Claude CLI with least-privilege service accounts and filesystem sandboxing until the upgrade is deployed.
bash
# Configuration example: enforce the patched version in requirements
pip install --upgrade 'claude-agent-sdk>=0.2.121'

# Verify installed version
python -c "import importlib.metadata as m; print(m.version('claude-agent-sdk'))"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.