/

CVE-2026-32056

Severity:

HIGH RISK

(7.5)

OS Command Injection in OpenClaw system.run

CVE-2026-32056

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenClaw releases before 2026.2.22 inherit HOME and ZDOTDIR directly into the system.run shell startup phase, enabling malicious startup scripts to run before command allowlist checks occur.

Attackers who can influence these environment variables can execute arbitrary code by planting crafted initialization files, effectively neutralizing the intended command restrictions.

Affected context

The flaw materializes when OpenClaw deployments use system.run to execute shell commands while trusting user-controlled HOME or ZDOTDIR values.

Environments that permit remote users to set or override startup paths, or that source shared file systems for shell configuration files, inherit untrusted shell scripts before the allowlist is enforced.

Exploit preconditions

  • Attack surface: Remote invocation of system.run-driven shell sessions
  • Required access: Ability to set HOME/ZDOTDIR or write startup files (.bash_profile, .zshenv) reachable by the invoked shell
  • Trigger point: Shell initialization executed prior to allowlisted command evaluation
  • Why exploitation is possible: system.run fails to sanitize or override critical environment variables, so untrusted init files execute immediately

Why this happens

The system.run implementation spawns shells that implicitly source initialization files from HOME/ZDOTDIR without validation.

This design aligns with CWE-78 because untrusted environment data directs command evaluation logic, allowing attacker-controlled scripts to run.

Potential impact

  • Arbitrary command execution under the OpenClaw runtime context
  • Bypass of administrative allowlists or policy-enforced command sets
  • Installation of persistence mechanisms via malicious shell profiles

General mitigation guidance

  • Normalize shell startup variables before process creation, forcing known-safe HOME/ZDOTDIR paths.
  • Launch shells with restrictive profiles or disable sourcing of user-provided init files.
  • Apply strict privilege separation so that even if initialization runs, it executes with minimal capabilities.
  • Treat environment inputs as untrusted and validate them prior to invoking helper binaries or shells.

How teams detect issues like this

  • Static analysis for shell invocations that inherit unsanitized environment variables.
  • Code review checklists calling out reliance on HOME/ZDOTDIR or other shell init locations.
  • Runtime policy enforcement and audit hooks that flag unexpected profile sourcing or startup script modifications.
  • Continuous monitoring tools can watch for unexpected .bash_profile/.zshenv creations near OpenClaw workloads.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/commit/c2c7114ed39a547ab6276e1e933029b9530ee906
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-xgf2-vxv2-rrmg
vulncheck.comvulncheck.com/advisories/openclaw-remote-code-execution-via-shell-startup-environment-variable-injection-in-system-run

Frequently asked

questions

Exploitation is straightforward once an attacker can influence HOME/ZDOTDIR or plant startup files, because the shell automatically processes them before any allowlist logic executes.

Remote access that allows modification of startup directories or environment variables suffices; root privileges are not necessary.

Force shells spawned by system.run to use vetted, immutable initialization paths or invoke non-interactive shells that skip user startup files.

Adopt a policy of sanitizing all inherited environment variables, minimize reliance on shell-based execution, and subject shell-launching code to automated checks for trusted initialization flows.

Find out what's already
exploitable in your codebase.