AgentbeamBeta
AI agent vulnerability · OpenClaw

GHSA-j9pv-rrcj-6pfx: OpenClaw: SSH-based sandbox backends pass unsanitized process.env to child processes

mediumCVSS 4.0 5.1

OpenClaw up to 2026.3.28 starts local SSH child processes for its SSH and OpenShell sandbox backends with the full, unfiltered process.env. API keys held in the gateway's environment become visible to those processes. The maintainers rate it low because remote leakage needs non-default SSH env forwarding. Fixed in 2026.3.31.

Published Apr 2, 2026 · Analysis Nov 7, 2026

What an attacker can do

When OpenClaw runs a sandbox over SSH, it spawns local ssh processes to execute commands and upload directories. In the SSH backend, buildExecSpec in src/agents/sandbox/ssh-backend.ts, and in the OpenShell extension's two exec paths, those spawns used env: process.env. Secrets in the host environment, such as OPENAI_API_KEY or Anthropic keys, went to the child (CWE-212).

The leak is local. Reading those values from the ssh child or its wrapper needs local access to the gateway host. Reaching the remote sandbox needs SSH to forward environment variables, which is not the default. That is why the CVSS 4.0 vector is local with low confidentiality impact.

The risk is a gateway host that holds model-provider keys and uses SSH sandboxes, especially if a custom SSH config or wrapper forwards environment variables to a remote machine less trusted than the gateway.

Who is affected

The openclaw npm package, 2026.3.28 and earlier. It matters only if you use the SSH sandbox backend or the OpenShell plugin's SSH execution, and keep secrets in the gateway process environment. Fixed in 2026.3.31.

npm ls openclaw

openclaw

Ecosystem
npm
Affected
<= 2026.3.28
Fixed in
2026.3.31
Check
npm ls openclaw

How to fix it

Upgrade to openclaw 2026.3.31:

npm install [email protected]

The fix passes sanitizeEnvVars(process.env).allowed instead of process.env in ssh-backend.ts, and adds buildOpenShellSshExecEnv() for the OpenShell extension. Tests confirm OPENAI_API_KEY and Anthropic keys are dropped while LANG stays. Turn off SSH environment forwarding (SendEnv in your SSH config) until you upgrade. The sources give no other workaround.

How to tell if you were hit

Check your SSH client and server config for SendEnv or AcceptEnv entries that could pass environment variables to sandbox hosts. On the remote side, run env inside a sandbox session and look for model-provider key names. If you find any, rotate those keys.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

SSH-based sandbox backends pass unsanitized process.env to child processes

Current Maintainer Triage

  • Status: narrow
  • Normalized severity: low
  • Assessment: Shipped SSH sandbox paths leaked unsanitized env into local SSH child processes, but remote leakage needs non-default SSH env forwarding, so lower to low.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Latest published npm version: 2026.3.31
  • Vulnerable version range: <=2026.3.28
  • Patched versions: >= 2026.3.31
  • First stable tag containing the fix: v2026.3.31

Fix Commit(s)

  • cfe14459531e002a1c61c27d97ec7dc8aecddc1f — 2026-03-30T20:05:57+01:00

OpenClaw thanks @AntAISecurityLab for reporting.

Credited to AntAISecurityLab.

Questions

Does this send my API keys to the remote sandbox?

Only if SSH environment forwarding is enabled, which is not the default. The unfiltered environment always reached the local ssh child process.

Which versions are affected?

openclaw 2026.3.28 and earlier. Version 2026.3.31 contains the fix.

Is there a CVE for this?

The advisory has no CVE id. It is tracked as GHSA-j9pv-rrcj-6pfx with a CVSS 4.0 score of 5.1.

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