CVE-2026-96620
CLI flag injection via unvalidated resume token leads to arbitrary command exec on startup.
- CVSS 9.2
- CWE-20
- Input Validation and Sanitization
- Remote
Claude Agent SDK is a Python SDK for Claude Code. Prior to 0.2.121, the resume option is passed to the Claude CLI as a separate token without validation, so a dash-leading value is parsed as an independent CLI flag. An attacker can inject the –mcp-config flag to define a stdio MCP server, causing arbitrary command execution at CLI startup outside the SDK permission controls. The issue is exploitable when an application passes untrusted input as the session ID to resume. This issue is fixed in version 0.2.121.
- CWE
- CWE-20
- CVSS base score
- 9.2
- Published
- 2026-10-16
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Claude Agent SDK
- Fixed by upgrading
- Yes
Solution
Upgrade Claude Agent SDK to version 0.2.121 or later.
Vulnerable code sample
import subprocess
def start_claude(session_id: str):
# VULNERABLE: unvalidated session_id becomes separate CLI flag
cmd = ["claude", "run", "--resume", session_id]
subprocess.run(cmd, check=True)Patched code sample
import subprocess
def start_claude(session_id: str):
# FIX: reject or sanitize leading dash to prevent flag injection
if session_id.lstrip().startswith("-"):
raise ValueError("Invalid session_id")
cmd = ["claude", "run", "--resume", session_id]
subprocess.run(cmd, check=True)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Pass –resume and –session-id as a single argv token (#1123) (anthropics/claude-agent-sdk-python)
src/claude_agent_sdk/_internal/transport/subprocess_cli.py · SubprocessCLITransport._build_command
Cite this entry
@misc{vaitp:cve202696620,
title = {{CLI flag injection via unvalidated resume token leads to arbitrary command exec on startup.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-96620},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-96620/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
