Severity by source
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/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 command lookup helper and deep-link terminal launcher that allows local attackers to execute arbitrary commands by manipulating the TERMINAL environment variable. Attackers can inject shell metacharacters into the TERMINAL variable which are interpreted by /bin/sh when the command lookup helper constructs and executes shell commands with shell=true. The vulnerability can be triggered during normal CLI execution as well as via the deep-link handler path, 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 allows local attackers to execute arbitrary commands by poisoning the TERMINAL environment variable with shell metacharacters. The vulnerability affects both normal CLI operations and deep-link handlers, enabling privilege escalation to the user context running the CLI. Publicly available exploit code exists. With CVSS 8.6 (High) severity, this presents significant risk in CI/CD pipelines and developer environments where environment variables may be attacker-controlled.
Technical ContextAI
This vulnerability stems from CWE-78 (OS Command Injection) in the command lookup helper and deep-link terminal launcher components. The affected code constructs shell commands using shell=true in Python subprocess calls, passing unsanitized user-controlled input from the TERMINAL environment variable directly to /bin/sh. When the CLI needs to launch a terminal or execute commands, it reads the TERMINAL variable and concatenates it into a shell command string without proper escaping or validation. An attacker who can control environment variables-common in CI/CD systems, containerized environments, or shared developer workstations-can inject shell metacharacters (semicolons, pipes, backticks, command substitution operators) that break out of the intended command context and execute arbitrary code. The vulnerability exists in both cpe:2.3:a:anthropic:claude_code and cpe:2.3:a:anthropic:claude_agent_sdk_for_python, indicating the flaw is present in the core command execution logic shared across these developer tooling products. The deep-link handler path expands the attack surface beyond interactive CLI use to scenarios where malicious links could trigger exploitation.
RemediationAI
Immediate mitigation requires restricting control over the TERMINAL environment variable in environments running Claude Code CLI or Claude Agent SDK. In CI/CD systems, explicitly unset or validate the TERMINAL variable before executing Claude tooling, using allowlists of known-safe terminal emulator paths (e.g., /usr/bin/xterm, /usr/bin/gnome-terminal) and rejecting any values containing shell metacharacters. For containerized deployments, use readonly or restricted environment variable configurations. Organizations should monitor for vendor-released patches from Anthropic addressing the underlying shell=true subprocess invocation pattern-likely requiring migration to shell=false with proper argument list handling or implementing strict input validation and escaping for environment variable values passed to shell contexts. Until patches are available, consider disabling deep-link handler functionality if not required and running Claude tools in isolated, non-privileged containers with minimal environment variable exposure. Review CI/CD logs and developer workstation audit trails for suspicious TERMINAL variable values or unexpected command executions. Consult the Phoenix Security advisory at https://phoenix.security/critical-ci-cd-nightmare-3-command-injection-flaws-in-claude-code-cli-allow-credential-exfiltration/ for detailed technical analysis and interim mitigation strategies. Upstream fix availability not independently confirmed from available data-monitor Anthropic security advisories and GitHub repositories for patch releases.
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 enables arbitrary command execution vi
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-19438