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

GHSA-rm5c-4rmf-vvhw: OpenClaw: Sandbox file operations use check-then-act, bypassing fd-based TOCTOU defenses

mediumCVSS 4.0 5.8

OpenClaw 2026.3.28 and earlier check a path and then act on it in the workspace-only apply_patch remove and mkdir operations. A process that swaps a directory for a symlink between the two steps can make the sandbox delete or create things outside the workspace. Upgrade to openclaw 2026.3.31.

Published Apr 3, 2026 · Analysis Oct 30, 2026

What an attacker can do

In src/agents/apply-patch.ts, remove and mkdirp called assertSandboxPath to confirm the path was inside the workspace, then ran fs.rm or fs.mkdir on the path string. Between those two calls a directory component could be replaced with a symlink pointing outside the workspace. The check passed on the old target and the action hit the new one. This is a time-of-check to time-of-use race, and it defeats the file-descriptor-based defenses used elsewhere.

The attacker needs local code that can modify the workspace at the same moment, such as another process in the sandbox or a command the agent ran at an attacker's prompting. They must win a timing race, so the CVSS 4.0 vector sets high attack complexity and a present attack requirement. A win lets them delete files or directories, or create directories, outside the workspace, with the privileges of the OpenClaw process. The vector scores high integrity and availability impact and no confidentiality impact. The maintainers narrowed the issue to apply_patch remove and mkdir in workspace-only mode.

Who is affected

The npm package openclaw at 2026.3.28 and earlier, when apply_patch runs in workspace-only mode. Version 2026.3.31 is the first stable release with the fix. In non-workspace mode apply_patch still uses plain fs.rm and fs.mkdir, since no workspace boundary is enforced there.

Check your install:

npm ls -g openclaw
openclaw --version

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 or later.

npm install -g [email protected]

Commit 32a4a47d makes remove and mkdirp call removePathWithinRoot and mkdirPathWithinRoot from src/infra/fs-safe.ts. These run a Python helper, in src/infra/fs-pinned-path-helper.ts, that opens the workspace root with O_DIRECTORY and O_NOFOLLOW and walks each segment relative to the open directory fd, rejecting ... Python 3 must be available on the host. The helper's interpreter can be chosen with OPENCLAW_PINNED_PYTHON or OPENCLAW_PINNED_WRITE_PYTHON. The advisory names no workaround.

How to tell if you were hit

Look for unexpected deletions or new directories outside the agent workspace, and for symlinks inside the workspace that point outside it. Review the agent's apply_patch history for remove and mkdir operations that were issued together with commands creating or replacing symlinks. On patched versions, a swapped alias makes the operation fail instead of touching the outside path, so apply_patch errors tied to a symlink change can mark an attempt.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

Sandbox file operations use check-then-act, bypassing fd-based TOCTOU defenses

Current Maintainer Triage

  • Status: narrow
  • Normalized severity: medium
  • Assessment: Released workspace-only apply_patch remove and mkdir operations were still check-then-act, but the draft overstates scope by bundling broader edit paths; keep it open but narrow it to the actual sandbox-workspace mutation boundary.

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)

  • 32a4a47d602e0618f87b3e59f94d8c142767f860 — 2026-03-30T16:49:49+01:00

OpenClaw thanks @AntAISecurityLab for reporting.

Credited to AntAISecurityLab.

Questions

Which OpenClaw versions are affected by GHSA-rm5c-4rmf-vvhw?

2026.3.28 and earlier. The patched version is 2026.3.31. The advisory has no CVE id.

Does the fix need Python on the host?

Yes. The pinned path helper is a Python script. The commit picks the interpreter from OPENCLAW_PINNED_PYTHON, OPENCLAW_PINNED_WRITE_PYTHON or common python3 paths, and falls back to python3.

Is it exploited in the wild?

No source I read says so, and the entry has no CISA KEV flag. The race is hard to win, as the high attack complexity in the CVSS vector shows.

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