Severity by source
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Primary rating from NVD · only source for this CVE.
CVSS VectorNVD
Lifecycle Timeline
5DescriptionCVE.org
Anthropic Claude Code CLI and Claude Agent SDK contain an OS command injection vulnerability in the prompt editor invocation utility that allows attackers to execute arbitrary commands by crafting malicious file paths. Attackers can inject shell metacharacters such as $() or backtick expressions into file paths that are interpolated into shell commands executed via execSync. Although the file path is wrapped in double quotes, POSIX shell semantics (POSIX §2.2.3) do not prevent command substitution within double quotes, allowing injected expressions to be evaluated and resulting in arbitrary command execution with the privileges of the user running the CLI.
AnalysisAI
OS command injection in Anthropic Claude Code CLI and Claude Agent SDK for Python enables arbitrary command execution via malicious file paths containing shell metacharacters. Local attackers can exploit POSIX shell command substitution within double-quoted strings to execute commands with user privileges. Publicly available exploit code exists. With CVSS 8.4 (High) and local attack vector requiring user interaction, this represents elevated risk in CI/CD pipelines and development environments where untrusted file paths may be processed.
Technical ContextAI
The vulnerability resides in the prompt editor invocation utility (prompteditor.ts) within both Claude Code CLI (cpe:2.3:a:anthropic:claude_code) and Claude Agent SDK for Python (cpe:2.3:a:anthropic:claude_agent_sdk_for_python). The root cause is CWE-78 (OS Command Injection) stemming from unsafe use of Node.js execSync() to invoke shell commands. The code interpolates user-controlled file paths into shell command strings and wraps them in double quotes, incorrectly assuming this provides sufficient sanitization. However, POSIX shell specification §2.2.3 explicitly permits command substitution using $() or backtick syntax within double-quoted contexts. When attackers craft file paths containing expressions like $(malicious_command) or malicious_command, the shell evaluates these before treating the result as a file path argument. This violates the principle of command-argument separation and allows elevation from data injection to code execution. The vulnerability is particularly concerning in CI/CD contexts where automated systems may process repository file paths or artifact names without manual inspection.
RemediationAI
Primary mitigation requires patching to versions that properly sanitize file path arguments before shell invocation. Consult Anthropic security advisories and the VulnCheck advisory at https://www.vulncheck.com/advisories/anthropic-claude-code-agent-sdk-os-command-injection-via-prompteditor-ts for vendor-released patches and fixed version information. Upstream fix available per Phoenix Security disclosure; organizations should verify patched version availability from Anthropic official channels. Workarounds for environments unable to immediately patch include: implementing strict input validation to reject file paths containing shell metacharacters ($, backtick, semicolon, pipe, ampersand) before passing to Claude tools; using allowlist-based path validation accepting only alphanumeric and standard filesystem characters; avoiding use of Claude CLI/SDK in automated pipelines processing untrusted repository contents until patched; and employing containerized sandboxing with limited privileges when processing external file structures. For CI/CD environments, restrict Claude tool invocation to curated, pre-validated file sets and implement monitoring for unusual child process spawning patterns indicative of exploitation attempts.
More in Claude Code
View allOS command injection in Anthropic Claude Code CLI and Agent SDK for Python allows remote, unauthenticated attackers to e
OS command injection in Anthropic Claude Code CLI and Claude Agent SDK for Python allows local attackers to execute arbi
Claude Code prior to version 2.1.2 has a CVSS 10.0 sandbox escape in the bubblewrap sandboxing mechanism, allowing code
Claude Code is an agentic coding tool. Prior to 1.0.93, Due to errors in parsing shell commands related to $IFS and shor
Claude Code prior to version 2.0.57 failed to properly validate MCP tool inputs, allowing malicious MCP servers to injec
Claude Code is an agentic coding tool. Versions before 1.0.111 were vulnerable to Code Injection due to a bug in the sta
Claude Code versions before 2.0.72 allow authenticated attackers to execute arbitrary commands by exploiting a command p
Sandbox escape and code execution in Anthropic's Claude Code CLI (versions 2.1.38 through 2.1.162) lets a malicious repo
Sandbox escape in Claude Code versions prior to 2.1.64 enables arbitrary file writes outside the workspace by exploiting
Claude Code is an agentic coding tool. Rated high severity (CVSS 7.7), this vulnerability is remotely exploitable, no au
Claude Code versions prior to 2.0.65 allow attackers to steal Anthropic API keys from users by crafting malicious reposi
Claude Code versions prior to 1.0.111 fail to properly validate trusted domains for WebFetch requests, allowing attacker
Same weakness CWE-78 – OS Command Injection
View allSame technique Command Injection
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-19440
GHSA-72p2-f44p-v65f