CVE-2026-22217
Received Received - Intake
Arbitrary Code Execution in OpenClaw Shell-Env via $SHELL Exploit

Publication date: 2026-03-18

Last updated on: 2026-03-25

Assigner: VulnCheck

Description
OpenClaw version 2026.2.22 prior to 2026.2.23 contain 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.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-03-18
Last Modified
2026-03-25
Generated
2026-05-07
AI Q&A
2026-03-18
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
openclaw openclaw From 2026.2.22 (inc) to 2026.2.23 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-829 The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

[{'type': 'paragraph', 'content': "CVE-2026-22217 is an arbitrary code execution vulnerability in OpenClaw versions prior to 2026.2.23. It arises from the shell-env component's fallback logic for the $SHELL environment variable, which trusted certain directory prefixes to select a shell executable. If an attacker can write to one of these trusted-prefix directories (such as /opt/homebrew/bin) and influence the $SHELL environment variable, they can cause OpenClaw to execute attacker-controlled binaries within its process context."}, {'type': 'paragraph', 'content': "The vulnerability occurs because the fallback mechanism allowed execution of shells not explicitly registered in the system's /etc/shells file, relying instead on hardcoded trusted directory prefixes. This allowed attackers with local or environment control to execute arbitrary code by placing malicious binaries in writable trusted-prefix directories and manipulating $SHELL."}, {'type': 'paragraph', 'content': 'The issue was fixed in OpenClaw version 2026.2.23 by removing the trusted-prefix fallback and requiring that only shells explicitly listed in /etc/shells are trusted.'}] [1, 2, 3]


How can this vulnerability impact me? :

This vulnerability allows an attacker who can influence the $SHELL environment variable and write to trusted-prefix directories to execute arbitrary code within the OpenClaw process context.

Such arbitrary code execution can lead to unauthorized actions being performed on the affected system, potentially compromising system integrity, confidentiality, and availability.

Because the attacker can run arbitrary binaries, this could be used to escalate privileges, install malware, or disrupt normal operations.


How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

I don't know


How can this vulnerability be detected on my network or system? Can you suggest some commands?

[{'type': 'paragraph', 'content': 'Detection involves checking if your system is running OpenClaw versions prior to 2026.2.23 and if any trusted-prefix directories such as /opt/homebrew/bin are writable by untrusted users. Additionally, you should verify if the $SHELL environment variable can be influenced by an attacker.'}, {'type': 'list_item', 'content': 'Check OpenClaw version: run `openclaw --version` or check the installed package version to confirm if it is 2026.2.22 or earlier.'}, {'type': 'list_item', 'content': 'Check if trusted-prefix directories are writable: run `ls -ld /opt/homebrew/bin` and verify permissions to see if non-root users can write to it.'}, {'type': 'list_item', 'content': "Inspect the $SHELL environment variable in the context of OpenClaw processes: use `ps aux | grep openclaw` and check environment variables with `cat /proc/<pid>/environ | tr '\\0' '\\n' | grep SHELL` (Linux) to see if $SHELL is set to an unexpected or attacker-controlled path."}, {'type': 'list_item', 'content': 'Look for suspicious or unexpected executable files in trusted-prefix directories that could be malicious binaries.'}] [1, 2]


What immediate steps should I take to mitigate this vulnerability?

The primary mitigation is to upgrade OpenClaw to version 2026.2.23 or later, which removes the vulnerable trusted-prefix fallback logic and restricts trusted shells to those explicitly listed in /etc/shells.

  • Update OpenClaw to version 2026.2.23 or newer.
  • Ensure that trusted-prefix directories such as /opt/homebrew/bin are not writable by untrusted users to prevent placement of malicious binaries.
  • Audit and restrict environment variable manipulation, especially the $SHELL variable, in contexts where OpenClaw runs.
  • Verify that only shells explicitly registered in /etc/shells are used by OpenClaw processes.

Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart