NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · OpenClaw

CVE-2026-22217: OpenClaw: shell-env trusted-prefix fallback allowed attacker-controlled binary execution via $SHELL

mediumCVSS 4.0 5.8 · 3.1 6.1GHSA-p4wh-cr8m-gm6c

OpenClaw 2026.2.22 through 2026.2.22-2 trusted any executable under /bin, /usr/bin, /usr/local/bin, /opt/homebrew/bin or /run/current-system/sw/bin as a valid $SHELL. If a trusted directory is writable and $SHELL can be influenced, an attacker-controlled binary runs in the OpenClaw process. Upgrade the npm package openclaw to 2026.2.23.

Published Mar 3, 2026 · Updated Jun 8, 2026 · Analysis Oct 31, 2026

What an attacker can do

OpenClaw's shell-env code probes PATH and environment by launching the selected shell as a login shell with -l -c 'env -0'. In the affected versions it accepted a shell from /etc/shells, or any executable under the hardcoded trusted prefixes. The second rule is the flaw.

If the attacker can set the runtime $SHELL, and can put a binary in a writable trusted directory, OpenClaw launches that binary. The advisory gives /opt/homebrew/bin under common Homebrew layouts as an example of a writable prefix, where a user-owned directory sits in the trusted list.

The attacker needs local access with low privileges plus influence over OpenClaw's environment. The binary runs with the OpenClaw process's permissions, which gives code execution as that user. CVSS rates integrity as high and availability as low. The window is narrow: only two releases, 2026.2.22 and 2026.2.22-2, are listed.

Who is affected

npm package openclaw, versions >= 2026.2.22 and < 2026.2.23 (up to 2026.2.22-2). Exposure is highest on macOS with Homebrew in /opt/homebrew/bin, or on any host where a trusted-prefix directory is writable by a non-root user. Check:

npm ls openclaw
ls -ld /opt/homebrew/bin /usr/local/bin

openclaw

Ecosystem
npm
Affected
>= 2026.2.22, < 2026.2.23
Fixed in
2026.2.23
Check
npm ls openclaw

How to fix it

Upgrade to openclaw 2026.2.23 (fix commit ff10fe8b91670044a6bb0cd85deb736a0ec8fb55).

npm install [email protected]

The fix removes the trusted-prefix fallback. Only shells registered in /etc/shells are trusted, and otherwise OpenClaw falls back to /bin/sh. The advisory lists no separate workaround.

How to tell if you were hit

Check the $SHELL value in the environment that launches OpenClaw and confirm it is listed in /etc/shells. Look for unexpected or recently added executables in /opt/homebrew/bin, /usr/local/bin and the other trusted directories, and for login shells started with -l -c 'env -0' whose binary is not a real shell. Beam logs agent shell commands, which may show changes to $SHELL or new binaries.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

shell-env fallback trusted prefix-based executable paths for $SHELL, allowing execution of attacker-controlled binaries in local/runtime-env influence scenarios.

Details

In affected versions, shell selection accepted either:

  1. a shell listed in /etc/shells, or
  2. any executable under hardcoded trusted prefixes (/bin, /usr/bin, /usr/local/bin, /opt/homebrew/bin, /run/current-system/sw/bin).

The selected shell was then executed as a login shell (-l -c 'env -0') for PATH/environment probing.

On systems where a trusted-prefix directory is writable (for example common Homebrew layouts under /opt/homebrew/bin) and runtime $SHELL can be influenced, this enabled attacker-controlled binary execution in OpenClaw process context.

The fix removes the trusted-prefix executable fallback and now trusts only shells explicitly registered in /etc/shells; otherwise it falls back to /bin/sh.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Affected versions: >= 2026.2.22, <= 2026.2.22-2
  • Latest published vulnerable version: 2026.2.22-2
  • Patched versions (released): >= 2026.2.23

Fix Commit(s)

  • ff10fe8b91670044a6bb0cd85deb736a0ec8fb55

Release Process Note

This advisory sets patched_versions to the released version (2026.2.23). This advisory now reflects released fix version 2026.2.23.

OpenClaw thanks @tdjackey for reporting.

Credited to tdjackey.

Questions

Which OpenClaw versions are affected by CVE-2026-22217?

2026.2.22 through 2026.2.22-2. The advisory lists 2026.2.23 as the fixed release.

What does the fix change?

OpenClaw now trusts only shells in /etc/shells and falls back to /bin/sh otherwise, instead of accepting any executable under the trusted prefixes.

Does it need $SHELL to be controlled?

Yes. The advisory describes it as exploitable in local or runtime-environment influence scenarios, where $SHELL can be influenced and a trusted directory is writable.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More OpenClaw vulnerabilities

All OpenClaw entries