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

GHSA-x3h8-jrgh-p8jx: OpenClaw's exec allowlist analysis rejects shell expansion in unquoted heredocs

medium

OpenClaw up to 2026.4.21 could approve an allowlisted shell command whose unquoted heredoc hid shell expansion, so the approved text looked safer than what bash would run. The exec analyzer now rejects those forms. Upgrade the npm package openclaw to 2026.4.22.

Published May 4, 2026 · Updated May 13, 2026 · Analysis Nov 4, 2026

What an attacker can do

OpenClaw lets a user allowlist shell commands that an agent may run. The analyzer in src/infra/exec-approvals-analysis.ts reads the command text and decides whether it matches the allowlist. In an unquoted heredoc, bash still expands variables and command substitutions in the body. Before the fix, the analyzer rejected only $( and ${ there. Other forms passed: $[, and $ followed by a letter, underscore, digit or special parameter such as $@, $?, $$ and $#.

Backslash line continuations made it worse. A name split across lines, such as $OPENAI_API_ followed by KEY, was joined by bash but not seen as one token by the analyzer. So a command that looked like a harmless cat of text could, at runtime, expand an environment variable such as an API key into its output.

The advisory classes this as exposure of sensitive information (CWE-200) and rates it medium. The practical risk is an agent, possibly steered by prompt injection, running an approved command that leaks environment secrets in output the model or a log can see. It does not give a user outside the agent any new access, and the sources report no exploitation.

Who is affected

The npm package openclaw at 2026.4.21 and earlier, wherever exec allowlists are used to approve shell commands. Check:

npm ls openclaw

For a global install, use npm ls -g openclaw.

openclaw

Ecosystem
npm
Affected
<= 2026.4.21
Fixed in
2026.4.22
Check
npm ls openclaw

How to fix it

Upgrade to openclaw 2026.4.22.

npm install -g [email protected]

The fix, commit b2e8b7d4, makes the analyzer track heredoc bodies, reject unquoted heredoc expansion tokens and continuation-splice tricks, and keep quoted heredocs and literal safe text working. It also caps continuations at 1024 lines and logical lines at 64 KiB. The advisory lists no workaround. Until you upgrade, review allowlist entries that accept commands with heredocs, and keep secrets out of the agent's environment.

How to tell if you were hit

Review agent shell history and exec approval logs for commands that contain a heredoc (<<) with an unquoted delimiter and a $ in the body, or a trailing backslash inside it. Look for secrets, such as API keys, appearing in command output or transcripts. Beam records shell commands that agents run, and its rules can flag risky ones, which helps with this review.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

Exec allowlist analysis rejects shell expansion in unquoted heredocs

Affected Packages / Versions

  • Package: openclaw (npm)
  • Affected versions: <= 2026.4.21
  • Fixed version: 2026.4.22

Impact

An allowlisted command containing an unquoted heredoc could hide shell expansion in the heredoc body. That could make the approved command text look safer than what the shell would evaluate at runtime.

Fix

The exec command analyzer now tracks heredoc bodies, rejects unquoted heredoc expansion tokens and continuation-splice bypasses, and preserves quoted heredocs and literal safe text.

Fix Commit(s)

  • b2e8b7d4bb2f22eaa16f5c4b07547774e90b65a5

Verification

  • The fix commit is contained in the public v2026.4.22 tag.
  • [email protected] is published on npm and the compiled package contains the fix.
  • Focused regression coverage for this path passed before publication.

Thanks @VladimirEliTokarev for reporting.

Credited to VladimirEliTokarev.

Questions

Which OpenClaw version fixes this?

2026.4.22. Versions up to and including 2026.4.21 are affected.

Are quoted heredocs affected?

No. Bash does not expand a heredoc with a quoted delimiter, and the fixed analyzer leaves quoted heredocs unchanged.

What can leak?

Anything the shell can expand in the agent's environment, such as an environment variable holding an API key, if the expanded text ends up in output the agent or logs can read.

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