Mar 4, 2026·5 min read·21 visits
A race condition in OpenClaw's registry file handling allows concurrent writes to corrupt or wipe sandbox tracking data. Patched in 2026.2.18 via file locking and atomic writes.
OpenClaw versions prior to 2026.2.18 contain a critical race condition in the sandbox registry management system. The vulnerability arises from insecure file handling operations during read-modify-write cycles of the `containers.json` and `browsers.json` registry files. Concurrent attempts to update or remove registry entries can result in lost updates, state desynchronization, or complete truncation of the registry data. This flaw leads to orphaned containers and resource leaks in high-concurrency environments.
The OpenClaw framework maintains the state of active AI agent sandboxes and browser instances in JSON-based registry files (containers.json and browsers.json). These registries are critical for tracking resource allocation, lifecycle management, and cleanup operations. The vulnerability exists within the file I/O logic used to persist changes to these registries.
Prior to version 2026.2.18, the functions responsible for updating the registry did not implement adequate locking mechanisms or atomic write operations. This omission creates a Time-of-Check to Time-of-Use (TOCTOU) race condition (CWE-367) when multiple agent threads or processes attempt to modify the registry simultaneously.
The impact is primarily on data integrity. When the race condition triggers, the registry may revert to a previous state, lose specific entries, or be completely emptied. While this does not directly expose sensitive credentials, it compromises the stability of the agent orchestration layer, causing the system to lose track of running containers. This results in "orphaned" resources that consume system memory and CPU without being accessible or practically manageable by the framework.
The core failure lies in the implementation of the updateRegistry and removeRegistryEntry functions, which relied on a naive read-modify-write pattern without synchronization primitives. The operation followed this sequence:
In a concurrent environment, two processes (A and B) may read the file at the same time. If Process A writes its changes first, and Process B writes immediately after, Process B's write operation—based on the stale state it read earlier—overwrites Process A's changes. This constitutes a classic "Lost Update" problem (CWE-362).
Furthermore, the error handling logic in the original readRegistry implementation exacerbated the issue. The function utilized a broad catch block that suppressed exceptions (such as JSON parsing errors or partial reads caused by a concurrent write operation). Upon encountering an error, the function defaulted to returning an empty array []. If this empty state was subsequently written back to disk during an update cycle, the entire registry would be effectively deleted.
The vulnerability remediation required fundamental changes to how OpenClaw handles file persistence. The patch introduces serialization via file locking and ensures atomicity using temporary files.
Vulnerable Logic (Conceptual):
The original code performed direct writes to the target file. There was no mechanism to prevent overlapping I/O operations.
// Vulnerable: Direct asynchronous write without locking
async function updateRegistry(entry) {
const current = await readRegistry(); // Reads current state
current.push(entry);
// If another process writes here, those changes are lost below
await fs.writeFile(REGISTRY_PATH, JSON.stringify(current));
}Patched Logic:
The fix in commit cc29be8c9bcdfaecb90f0ab13124c8f5362a6741 introduces a withRegistryLock wrapper. This wrapper ensures that any operation modifying the registry acquires a session-based write lock before proceeding. Additionally, the write operation now writes to a temporary file first and uses fs.rename to replace the registry atomically.
// Fixed: Uses locking and atomic rename
export async function updateRegistry(entry: RegistryEntry) {
// 1. Acquire Lock
return withRegistryLock(async () => {
const current = await readRegistry();
// ... modify current ...
// 2. Write to temp file
const tempPath = `${REGISTRY_PATH}.${uuid()}.tmp`;
await fs.writeFile(tempPath, JSON.stringify(current));
// 3. Atomic replacement
await fs.rename(tempPath, REGISTRY_PATH);
});
}This approach guarantees that even if multiple processes attempt updates, they will be serialized. The atomic rename ensures that readers never encounter a partially written file, eliminating the risk of the "empty array" rollback corruption.
Exploitation of this vulnerability does not require malicious intent; it is often triggered strictly by normal operational load. However, an attacker with the ability to trigger multiple agent workflows could intentionally induce this state to disrupt system availability or hide the presence of malicious containers.
Attack Vector:
containers.json.sandbox list or cleanup scripts.The developers included a reproduction case in src/agents/sandbox/registry.test.ts that simulates this behavior by introducing artificial I/O latency (containerDelayMs: 80) to widen the race window, proving that concurrent writes consistently led to data loss in the unpatched version.
The vulnerability affects the integrity and availability of the OpenClaw infrastructure.
CVSS v3.1 Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L (Base Score: 6.6). The Attack Complexity is rated High (AC:H) because the successful trigger depends on specific timing conditions (race window), though in high-traffic environments, this condition is frequently met.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L| Product | Affected Versions | Fixed Version |
|---|---|---|
OpenClaw OpenClaw | < 2026.2.18 | 2026.2.18 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-362 (Race Condition) |
| Related CWE | CWE-367 (TOCTOU) |
| CVSS Score | 6.6 (Medium) |
| Attack Vector | Network |
| Integrity Impact | High |
| Availability Impact | Low |
| Patch Date | 2026-02-18 |
The software contains a race condition that allows concurrent operations to interfere with each other, leading to undefined or inconsistent state.
An uncontrolled resource consumption vulnerability exists in the Scala-based http4s-blaze-server package of the http4s/blaze library. The vulnerability allows remote, unauthenticated attackers to cause an Out of Memory Error (OOM) and JVM crash by streaming a continuous sequence of small or empty WebSocket continuation frames with the FIN bit set to 0. This bypasses typical payload size checks because of the JVM's per-object allocation overhead, leading to rapid heap exhaustion with minimal network bandwidth.
A critical path traversal vulnerability has been identified in the OpenList Go-based backend package. The vulnerability exists within the batch rename handler because the application does not validate the source filename parameter before constructing filesystems paths. This omission allows authenticated users to escape their designated directory and rename files in sibling paths.
OpenList version 4.2.3 and prior is vulnerable to an authorization bypass and metadata leakage. When configured with the Bleve search engine backend, OpenList fails to perform separator-aware path matching when validating tenant containment. This allows authenticated users to access sibling directories sharing similar name prefixes. Furthermore, the search backend returns unfiltered global result counts, leaking existence verification data of unauthorized files via side-channel analysis.
An authorization bypass vulnerability in OpenList version 4.2.3 and below allows authenticated users to read arbitrary files outside of their designated base directories due to an insecure path prefix check using Go's standard strings.HasPrefix function.
A security policy bypass vulnerability exists in the AWS API MCP Server (awslabs-aws-api-mcp-server) from version 0.2.13 through 1.3.46. When the server fails to load the read-only operations index during startup (due to transient network failures, file permission issues, or other exceptions), it logs a warning but continues running in an insecure, degraded state. Under this condition, the security policy engine fails open, silently skipping all subsequent security checks and consent prompts for the lifetime of the process. This permits unauthorized mutating AWS CLI commands to execute via indirect prompt injection attacks.
An incomplete escaping vulnerability in the npm package 'shescape' allows unauthenticated users to trigger dynamic shell expansions, absolute path disclosure, and command block break-outs on Unix and Windows systems.