AgentbeamBeta
AI agent vulnerability · OpenClaw

CVE-2026-32022: OpenClaw safeBins grep -e File Read Bypass (stdin-only policy bypass)

mediumCVSS 4.0 5.1 · 3.1 6.5GHSA-3xfw-4pmr-4xc5

OpenClaw before 2026.2.21 let a safe-bin grep read files despite the stdin-only rule. With grep -e SECRET .env, the -e flag took the pattern and the single allowed positional slot held the filename. It only applies when an operator added grep to tools.exec.safeBins. Fixed in 2026.2.21.

Published Mar 3, 2026 · Updated Jun 8, 2026 · Analysis Nov 15, 2026

What an attacker can do

Safe bins are meant to run only on piped input, with no file operands. In src/infra/exec-safe-bin-policy.ts, the grep profile set maxPositional to 1 and allowed the -e and --regexp value flags. When the pattern comes through -e, it is consumed as a flag value. That leaves the one positional slot free for a bare filename.

So grep -e SECRET .env passed validation in vulnerable builds. A caller that can invoke exec tools under the profile could read bare relative files in the working directory, such as .env or credentials.txt, in a flow that was supposed to be stdin-only.

The scope is narrow. grep is not in the default safe-bin list, so an operator must have added it. The attacker needs the ability to run exec tooling, which for an AI agent setup may mean an agent steered by a malicious prompt or file. The result is a confidentiality loss: file contents come back in grep output. The advisory notes no write or execution impact. The vendor scored it 5.3 under CVSS 3.1 for the non-default setup.

Who is affected

The openclaw npm package before 2026.2.21 (the advisory names 2026.2.19-2 as the latest vulnerable release). Check your install:

npm ls openclaw

Then check the config for grep in tools.exec.safeBins. If grep is not listed, the default safe-bin list does not include it and this path is closed. Only files directly in the working directory, named relatively, were reachable.

openclaw

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

How to fix it

Upgrade to openclaw 2026.2.21:

npm install -g [email protected]

The fix is commit c6ee14d6. It sets maxPositional for grep to 0 in the safe-bin profile. The pattern must now come from -e or --regexp, and any file operand is rejected, including after a -- terminator. Tests cover grep -e needle .env and grep -e needle -- .env, both denied.

The advisory gives no other workaround. Removing grep from tools.exec.safeBins closes the path.

How to tell if you were hit

Search exec logs for grep calls that pair -e or --regexp with a filename, especially .env, credentials files or other secrets in the working directory. Check the OpenClaw config for grep in tools.exec.safeBins. If an AI agent runs under Beam, it records agent shell commands and file access, which would show a grep reading .env.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

OpenClaw tools.exec.safeBins had a stdin-only policy bypass for grep. If pattern input was supplied through -e / --regexp, the validator consumed the pattern as a flag value and still allowed one positional operand. That positional could be a bare filename like .env.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Latest published vulnerable version: 2026.2.19-2
  • Structured vulnerable range: <= 2026.2.19-2
  • Planned fixed range for next release: >= 2026.2.21

Exploit Preconditions

  • tools.exec.safeBins must include grep (this is opt-in; grep is not in the default safe-bin list).
  • An actor must be able to invoke exec tooling under that profile.

Technical Details

src/infra/exec-safe-bin-policy.ts configured grep with maxPositional: 1 and allowed -e / --regexp value flags. Because -e consumes the pattern in flag-value position, the remaining positional budget could be used for a file operand. Example accepted input in vulnerable builds:

grep -e SECRET .env

That violated the intended stdin-only guarantee for safe bins.

Impact

With grep opt-in enabled, callers could read bare-relative files from the working directory (for example .env, credentials.txt) in flows expected to be stdin-only.

Severity Rationale

CVSS v3.1 is set to: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N (5.3, Medium)

AC:H is used because exploitation depends on a non-default configuration (grep must be explicitly added to safe bins) in addition to normal low-privilege tool-invocation capability.

Fix Commit(s)

  • c6ee14d60e4cbd6a82f9b2d74ebeb1e8ee814964

Release Process Note

patched_versions is pre-set to >= 2026.2.21 so this advisory is ready to publish after the 2026.2.21 npm release is live.

OpenClaw thanks @athuljayaram for reporting.

Credited to athuljayaram.

Questions

Is the default OpenClaw install affected by CVE-2026-32022?

No. grep is not in the default safe-bin list. It is exposed only when an operator adds grep to tools.exec.safeBins.

What files can be read?

Bare relative files in the working directory, such as .env or credentials.txt. The advisory describes the one positional slot freed by -e, not a general file read.

Which version fixes it?

2026.2.21. Earlier versions are affected. The fix sets grep's positional limit to zero so file operands are denied.

Is it exploited in the wild?

No source reports exploitation, and the entry has no CISA KEV data.

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