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.
CVE-2026-35020 is a critical OS command injection vulnerability in Anthropic Claude Code CLI and Claude Agent SDK that allows local attackers to execute arbitrary commands by manipulating the TERMINAL environment variable. The vulnerability exists in the command lookup helper and deep-link terminal launcher components, exploitable during normal CLI execution. With a CVSS score of 8.4 and no patch currently available, this poses an immediate risk to organizations using Claude development tools.
IMMEDIATE ACTIONS:
1. Audit all systems running Claude Code CLI or Claude Agent SDK - identify affected versions and deployment locations
2. Restrict TERMINAL environment variable usage - implement environment variable whitelisting policies
3. Disable Claude CLI execution in shared/multi-user environments until patch is available
4. Review access logs for suspicious TERMINAL variable modifications
COMPENSATING CONTROLS:
1. Implement strict environment variable validation - use allowlists for TERMINAL values
2. Run Claude CLI with minimal privileges - use dedicated service accounts with restricted permissions
3. Disable shell=true execution where possible - use subprocess with shell=False in wrapper scripts
4. Monitor process execution - implement EDR/XDR solutions to detect suspicious child processes from Claude CLI
5. Isolate development environments - use containerization (Docker) with restricted environment variables
6. Implement code review processes for any scripts using Claude CLI output
DETECTION RULES:
1. Monitor for TERMINAL environment variable modifications containing shell metacharacters (|, ;, &, $, `, etc.)
2. Alert on unexpected child process spawning from Claude CLI processes
3. Log all environment variable changes in development environments
4. Monitor /bin/sh execution patterns originating from Claude CLI processes
5. Track failed and successful command execution attempts with suspicious TERMINAL values
PATCHING GUIDANCE:
1. Subscribe to Anthropic security advisories for patch availability
2. Prepare patch deployment procedures for immediate application upon release
3. Maintain inventory of all Claude CLI/SDK installations for rapid patching
الإجراءات الفورية:
1. تدقيق جميع الأنظمة التي تقوم بتشغيل Claude Code CLI أو Claude Agent SDK - تحديد الإصدارات المتأثرة ومواقع النشر
2. تقييد استخدام متغير بيئة TERMINAL - تنفيذ سياسات القائمة البيضاء لمتغيرات البيئة
3. تعطيل تنفيذ Claude CLI في البيئات المشتركة/متعددة المستخدمين حتى يتوفر التصحيح
4. مراجعة سجلات الوصول للتعديلات المريبة على متغير TERMINAL
الضوابط التعويضية:
1. تنفيذ التحقق الصارم من متغيرات البيئة - استخدام القوائم البيضاء لقيم TERMINAL
2. تشغيل Claude CLI بامتيازات محدودة - استخدام حسابات خدمة مخصصة بأذونات مقيدة
3. تعطيل تنفيذ shell=true حيث أمكن - استخدام subprocess مع shell=False في البرامج النصية الملفوفة
4. مراقبة تنفيذ العملية - تنفيذ حلول EDR/XDR للكشف عن العمليات الفرعية المريبة من Claude CLI
5. عزل بيئات التطوير - استخدام الحاويات (Docker) مع متغيرات بيئة مقيدة
6. تنفيذ عمليات مراجعة الأكواد لأي برامج نصية تستخدم مخرجات Claude CLI
قواعد الكشف:
1. مراقبة تعديلات متغير بيئة TERMINAL التي تحتوي على أحرف ميتا shell (|، ;، &، $، `، إلخ)
2. التنبيه على توليد العمليات الفرعية غير المتوقعة من عمليات Claude CLI
3. تسجيل جميع تغييرات متغيرات البيئة في بيئات التطوير
4. مراقبة أنماط تنفيذ /bin/sh الناشئة من عمليات Claude CLI
5. تتبع محاولات تنفيذ الأوامر الفاشلة والناجحة مع قيم TERMINAL المريبة
إرشادات التصحيح:
1. الاشتراك في استشارات أمان Anthropic لتوفر التصحيحات
2. تحضير إجراءات نشر التصحيحات للتطبيق الفوري عند الإصدار
3. الحفاظ على جرد جميع تثبيتات Claude CLI/SDK للتصحيح السريع