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

GHSA-5h2c-8v84-qpvr: OpenClaw shell-env fallback trusted startup env and could execute attacker-influenced login-shell paths

mediumCVSS 3.1 5.3

OpenClaw 2026.1.5 through 2026.2.21-2 ran a login shell for its shell-env fallback using environment values it trusted, including `SHELL`, `HOME` and `ZDOTDIR`. Attacker-controlled env or config could make that shell run unintended commands at startup. Upgrade `openclaw` to 2026.2.22.

Published Mar 3, 2026 · Analysis Oct 31, 2026

What an attacker can do

The chain starts in src/infra/shell-env.ts. resolveShell(env) trusted env.SHELL when set, and execLoginShellEnvZero(...) ran ${SHELL} -l -c "env -0" with the inherited runtime environment. In src/config/io.ts, config env values were applied before that fallback ran. An earlier hardening covered SHELL, but HOME and ZDOTDIR, which choose where a shell reads its startup files, were still allowed through config env ingestion. Pointing them at attacker-controlled files makes the login shell source those files and run their commands as the OpenClaw process (CWE-15, CWE-78).

The attacker needs influence over the environment or config that reaches the fallback. The advisory states this is a local code-execution risk and not a public-remote issue under OpenClaw's trust assumptions: it depends on crossing a local trusted-operator boundary. The CVSS 3.1 vector is local with low privileges and low impact on each of confidentiality, integrity and availability.

For teams, the cases to worry about are shared hosts or pipelines where lower-trust users or generated configs can set OpenClaw env values, and agent setups where an agent can write to config.

Who is affected

The openclaw npm package from 2026.1.5 up to and including 2026.2.21-2, in environments where untrusted env or config input can reach the shell-env fallback. Check the version:

npm ls openclaw
openclaw --version

Then review your OpenClaw config's env section for SHELL, HOME and ZDOTDIR.

openclaw

Ecosystem
npm
Affected
< 2026.2.22
Fixed in
2026.2.22
Check
npm ls openclaw

How to fix it

Upgrade to 2026.2.22:

npm install -g [email protected]

The fix is commit 9363c320d8ffe29290906752fab92621da02c3f7. It blocks SHELL, HOME and ZDOTDIR during config env ingestion used by the runtime fallback. It also sanitizes the environment for the fallback shell by pinning HOME to the real user home and dropping ZDOTDIR and other dangerous startup variables. Regression tests cover both paths. The sources name no workaround.

How to tell if you were hit

Check the OpenClaw config's env entries for SHELL, HOME or ZDOTDIR values you did not set. Inspect the startup files that a login shell would read from any such location (.zshenv, .zshrc, .zprofile, .bash_profile) for commands you do not recognize. Look for -l -c env -0 shell invocations from the OpenClaw process with an unusual parent or shell path. The sources give no fixed log string.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

OpenClaw shell-env fallback trusted startup environment values and could execute attacker-influenced login-shell startup paths before loading env keys.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Affected versions: >= 2026.1.5 and <= 2026.2.21-2
  • Fixed on main: 9363c320d8ffe29290906752fab92621da02c3f7
  • Planned patched release version (pre-set): 2026.2.22

Details

The vulnerable chain was in the shell-env fallback path:

  1. src/infra/shell-env.ts
  2. resolveShell(env) trusted env.SHELL when set.
  3. execLoginShellEnvZero(...) executed ${SHELL} -l -c "env -0" with inherited runtime env.
  1. src/config/io.ts
  2. Config env values were applied before shell fallback execution.
  1. src/config/env-vars.ts / env policy coverage
  2. SHELL handling was hardened, but startup-path selectors (HOME, ZDOTDIR) still needed explicit blocking in config env ingestion and sanitization for shell fallback execution.

With env/config influence, this could trigger unintended command execution in shell startup processing on the OpenClaw host process context.

Fix

Mainline hardening now:

  • blocks SHELL, HOME, and ZDOTDIR during config env ingestion used by runtime fallback,
  • sanitizes shell fallback execution env, pinning HOME to the real user home and dropping ZDOTDIR + dangerous startup vars,
  • adds regression tests for config env ingestion and shell fallback/path-probe sanitization.

Fix Commit(s)

  • 9363c320d8ffe29290906752fab92621da02c3f7

Impact

  • Local code-execution risk in environments where attacker-controlled env/config input can reach shell-env fallback.
  • Under OpenClaw trust assumptions (SECURITY.md), this is not a public-remote issue and depends on crossing local trusted-operator boundaries.

Release Process Note

patched_versions is intentionally pre-set to the planned next release (2026.2.22) so once npm release is out, maintainers can publish advisory immediately.

OpenClaw thanks @tdjackey for reporting.

Credited to tdjackey.

Questions

Is GHSA-5h2c-8v84-qpvr remotely exploitable?

The advisory says it is not a public-remote issue under OpenClaw's trust assumptions. It depends on attacker-controlled env or config input reaching the shell-env fallback, which means crossing a local trusted-operator boundary.

Which versions are affected?

2026.1.5 through 2026.2.21-2. The fix ships in 2026.2.22.

Which variables are blocked now?

SHELL, HOME and ZDOTDIR are blocked in config env ingestion, and the fallback shell runs with HOME pinned to the real user home and ZDOTDIR and other dangerous startup variables dropped.

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