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

GHSA-x82f-27x3-q89c: OpenClaw's TOCTOU symlink race in writeFileWithinRoot could create or truncate files outside root boundaries

highCVSS 4.0 8.7

OpenClaw 2026.2.26 and earlier had a symlink race in `writeFileWithinRoot`: an attacker-controlled path alias could be retargeted outside the configured root between path resolution and the write, creating or truncating files outside the root. Fixed in 2026.3.1.

Published Mar 2, 2026 · Analysis Oct 31, 2026

What an attacker can do

writeFileWithinRoot is meant to keep writes inside a root directory. It resolved the path first and wrote afterwards. If a symlink in the path was retargeted between those two steps, the write landed outside the root. The boundary check came last, so the side effects had already happened: a missing file could be created, and an existing file could be truncated.

The damage is to integrity: an attacker who can plant and swap a symlink inside the root can empty or create files elsewhere that the OpenClaw process can write, such as configuration or state files. The advisory reports no file read and no code execution. It does not say how the symlink gets into the root, so the practical precondition is write access to that area, for example through content an agent processes or a shared workspace.

Who is affected

The openclaw npm package at 2026.2.26 and earlier (all versions below 2026.3.1). Features that write files into a root directory through writeFileWithinRoot are the ones involved.

npm ls -g openclaw
openclaw --version

openclaw

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

How to fix it

Upgrade to openclaw 2026.3.1.

npm install -g [email protected]

The root-scoped write flow now opens existing files without truncating them, creates missing files with exclusive-create semantics, truncates only after identity and boundary checks pass on the opened file, and removes out-of-root artifacts when it detects a race. The advisory lists no workaround.

How to tell if you were hit

Look for symlinks inside the OpenClaw root or workspace that point outside it, and for files outside the root that were unexpectedly emptied or newly created around the time of a write. Fixed versions delete out-of-root artifacts when they detect the race, so a repeating cleanup after upgrade points to attempted abuse. Beam's logs of agent file access and shell commands can show symlink creation next to the workspace.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

A symlink-retarget TOCTOU race in writeFileWithinRoot could point an attacker-controlled path alias outside the configured root between resolution and write operations.

Impact

Affected versions could cause out-of-root write side effects (including file creation or truncation) before final boundary validation.

Fix

Root-scoped write flow now opens existing files without pre-truncation, creates missing files with exclusive create semantics, truncates only after post-open identity/boundary checks, and removes out-of-root artifacts when a race is detected.

Affected and Patched Versions

  • Affected: <= 2026.2.26
  • Patched: 2026.3.1

Credited to tdjackey.

Questions

Can this flaw read files outside the root?

The advisory describes only write side effects: creating or truncating files. It does not report any read or code execution.

Which OpenClaw version fixes GHSA-x82f-27x3-q89c?

2026.3.1. Versions up to and including 2026.2.26 are affected.

Why did the boundary check not stop it?

The check ran after the write operations. The create or truncate had already taken effect when the final validation failed.

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