CVE-2026-22217: OpenClaw: $SHELL env hijack enables arbitrary code execution
MEDIUMOpenClaw versions prior to 2026.2.23 allow a low-privileged local attacker to execute arbitrary binaries within the AI agent's process context by planting a malicious binary in a writable trusted-prefix directory — such as /opt/homebrew/bin on macOS — and exploiting the shell-env component's trusted-prefix fallback logic for the $SHELL variable. Despite a moderate CVSS of 6.1, this vulnerability ranks in the top 97th percentile of EPSS likelihood with zero user interaction or special skills required to exploit it. With 396 prior CVEs against this package and documented real-world abuse of OpenClaw's skills ecosystem for credential theft (AIID #1368), the blast radius for AI agent deployments is significant: an attacker gaining execution in OpenClaw's process context inherits access to all its credentials, API keys, and connected tools. Upgrade to OpenClaw 2026.2.23 immediately; in the interim, lock down write permissions on trusted-prefix directories and audit $SHELL environment variable handling in any automated agent pipeline.
What is the risk?
Risk is elevated beyond the CVSS 6.1 medium rating in AI agent contexts. Attack complexity is low — no specialized AI/ML knowledge required — and only local low-privilege access is needed, making exploitation accessible to commodity threat actors. The integrity impact is high (I:H), and AI agents typically run with broad system permissions including credential access and external API connectivity. OpenClaw's historically poor security posture (396 CVEs) and the documented weaponization of its skills ecosystem for credential theft in the wild significantly raise the practical likelihood of exploitation. On macOS developer workstations running Homebrew, /opt/homebrew/bin is writable by the local user by default, removing any practical barrier to dropping a malicious binary.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| OpenClaw | pip | — | No patch |
Do you use OpenClaw? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
Patch: Upgrade OpenClaw to version 2026.2.23 or later immediately — the vendor commit ff10fe8b91670044a6bb0cd85deb736a0ec8fb55 addresses the trusted-prefix fallback logic.
-
Directory hardening: Restrict write permissions on trusted-prefix directories (chmod o-w /opt/homebrew/bin and equivalent paths); ensure only privileged users can write to any directory on the $PATH resolved by OpenClaw.
-
Environment pinning: Audit and explicitly pin the $SHELL variable in all OpenClaw process environments; avoid inheriting ambient user shell values in agent runtimes.
-
Detection: Deploy EDR rules to alert on unexpected child process execution spawned from OpenClaw processes, particularly binaries in /opt/homebrew/bin or similar user-writable PATH entries.
-
Skills audit: Review all installed OpenClaw skills for malicious content — per AIID #1368, approximately 17% of community skills in the ClawHub ecosystem were assessed as malicious in early 2026.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-22217?
OpenClaw versions prior to 2026.2.23 allow a low-privileged local attacker to execute arbitrary binaries within the AI agent's process context by planting a malicious binary in a writable trusted-prefix directory — such as /opt/homebrew/bin on macOS — and exploiting the shell-env component's trusted-prefix fallback logic for the $SHELL variable. Despite a moderate CVSS of 6.1, this vulnerability ranks in the top 97th percentile of EPSS likelihood with zero user interaction or special skills required to exploit it. With 396 prior CVEs against this package and documented real-world abuse of OpenClaw's skills ecosystem for credential theft (AIID #1368), the blast radius for AI agent deployments is significant: an attacker gaining execution in OpenClaw's process context inherits access to all its credentials, API keys, and connected tools. Upgrade to OpenClaw 2026.2.23 immediately; in the interim, lock down write permissions on trusted-prefix directories and audit $SHELL environment variable handling in any automated agent pipeline.
Is CVE-2026-22217 actively exploited?
No confirmed active exploitation of CVE-2026-22217 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-22217?
1. Patch: Upgrade OpenClaw to version 2026.2.23 or later immediately — the vendor commit ff10fe8b91670044a6bb0cd85deb736a0ec8fb55 addresses the trusted-prefix fallback logic. 2. Directory hardening: Restrict write permissions on trusted-prefix directories (chmod o-w /opt/homebrew/bin and equivalent paths); ensure only privileged users can write to any directory on the $PATH resolved by OpenClaw. 3. Environment pinning: Audit and explicitly pin the $SHELL variable in all OpenClaw process environments; avoid inheriting ambient user shell values in agent runtimes. 4. Detection: Deploy EDR rules to alert on unexpected child process execution spawned from OpenClaw processes, particularly binaries in /opt/homebrew/bin or similar user-writable PATH entries. 5. Skills audit: Review all installed OpenClaw skills for malicious content — per AIID #1368, approximately 17% of community skills in the ClawHub ecosystem were assessed as malicious in early 2026.
What systems are affected by CVE-2026-22217?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, local AI agent deployments, AI-assisted developer tooling, multi-agent pipelines, CI/CD with AI agents.
What is the CVSS score for CVE-2026-22217?
CVE-2026-22217 has a CVSS v3.1 base score of 6.1 (MEDIUM). The EPSS exploitation probability is 0.13%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0050 Command and Scripting Interpreter AML.T0083 Credentials from AI Agent Configuration AML.T0112.000 Local AI Agent Compliance Controls Affected
What are the technical details?
Original Advisory
OpenClaw version 2026.2.22 prior to 2026.2.23 contains an arbitrary code execution vulnerability in shell-env that allows attackers to execute attacker-controlled binaries by exploiting trusted-prefix fallback logic for the $SHELL variable. An attacker can influence the $SHELL environment variable on systems with writable trusted-prefix directories such as /opt/homebrew/bin to execute arbitrary binaries in the OpenClaw process context.
Exploitation Scenario
An attacker with a low-privilege foothold on a macOS developer machine — obtained, for example, via a malicious OpenClaw skill distributed through ClawHub — creates a malicious binary named after the expected shell (e.g., zsh) and places it in /opt/homebrew/bin, which is writable by the local user under a default Homebrew installation. The attacker either manipulates the $SHELL environment variable directly or relies on OpenClaw's trusted-prefix fallback logic to resolve the shell binary from /opt/homebrew/bin before the system path. The next time OpenClaw's shell-env component invokes the shell — which occurs automatically during agent task execution — it runs the attacker's binary in the OpenClaw process context. From this position, the attacker exfiltrates API keys, LLM credentials, and agent configuration data, then pivots laterally to connected databases, cloud services, and any LLM APIs the agent is authorized to access.
Weaknesses (CWE)
CWE-829 — Inclusion of Functionality from Untrusted Control Sphere: The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.
- [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
- [Architecture and Design] When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-45] provide this capability.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L References
- github.com/openclaw/openclaw/commit/ff10fe8b91670044a6bb0cd85deb736a0ec8fb55 patch
- github.com/openclaw/openclaw/security/advisories/GHSA-p4wh-cr8m-gm6c vendor-advisory
- vulncheck.com/advisories/openclaw-arbitrary-binary-execution-via-shell-environment-variable-trusted-prefix-fallback third-party-advisory
Timeline
Related Vulnerabilities
CVE-2026-33579 9.9 OpenClaw: scope bypass escalates low-priv to admin
Same package: openclaw CVE-2026-32922 9.9 OpenClaw: privilege escalation to RCE via token scope bypass
Same package: openclaw CVE-2026-30741 9.8 OpenClaw: RCE via request-side prompt injection
Same package: openclaw CVE-2026-32038 9.8 OpenClaw: sandbox bypass enables container lateral movement
Same package: openclaw CVE-2026-53838 9.8 OpenClaw: approval scope bypass via reconnection state
Same package: openclaw