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

CVE-2026-35668: OpenClaw has Sandbox Media Root Bypass via Unnormalized `mediaUrl` / `fileUrl` Parameter Keys (CWE-22)

highCVSS 3.1 7.7GHSA-hr5v-j9h9-xjhg

OpenClaw's sandbox media check skipped the mediaUrl and fileUrl keys in message tool calls. A sandboxed agent could use them to read files from other agents' workspaces and send them out as channel attachments. OpenClaw before 2026.3.24 is affected. Upgrade to 2026.3.24.

Published Mar 30, 2026 · Updated Apr 10, 2026 · Analysis Oct 31, 2026

What an attacker can do

normalizeSandboxMediaParams (src/infra/outbound/message-action-params.ts) checks only the keys media, path and filePath against the agent's sandbox root. mediaUrl and fileUrl, which the Discord, Telegram, Slack, Matrix and Twitch extensions use for attachments, were never checked (CWE-22).

A second gap made it worse. handlePluginAction in src/infra/outbound/message-action-runner.ts called dispatchChannelMessageAction without mediaLocalRoots. Plugins then fell back to getDefaultMediaLocalRoots(), which allows reading the whole ~/.openclaw/ tree, including every agent's workspace.

So a sandboxed Agent-A that calls the message tool with mediaUrl pointing at Agent-B's secret file gets the content back as a channel attachment. The advisory's proof of concept read an API key from another agent's workspace. The attacker must influence an agent's tool calls: through prompt injection, multi-agent interaction or a malicious plugin instruction. Exposed data includes API keys, session data, conversation logs and credentials in config files. This defeats the per-agent isolation the project documents as a security boundary.

Who is affected

The openclaw npm package before 2026.3.24, on gateways running several agents with sandbox isolation and one or more channel extensions (Discord, Telegram, Slack, Matrix, Twitch). The advisory tested versions up to 2026.3.14 and the package data covers everything below 2026.3.24. A single-agent setup has less to leak across agents but still loses the sandbox root. Check your version:

npm ls openclaw
openclaw --version

openclaw

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

How to fix it

Upgrade to openclaw 2026.3.24 or later:

npm install -g [email protected]

The advisory header says the issue is fixed in 2026.3.24 and links no commit. The sources give no workaround. Until you upgrade, treat agent workspaces as readable by any agent that can send messages, keep secrets out of workspace files, and rotate any key that sits under ~/.openclaw/.

How to tell if you were hit

Review message tool calls in agent transcripts for mediaUrl or fileUrl values that point to a path outside the calling agent's own workspace, such as another agent's directory under ~/.openclaw/workspace/. Look in channel history for unexpected attachments sent by agents, especially files named like keys, logs or config.

Beam records agent file access and MCP tool calls, so reads of another agent's workspace files would show up there and can be flagged by its rules.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Fixed in OpenClaw 2026.3.24, the current shipping release.

Advisory Details

Title: Sandbox Media Root Bypass via Unnormalized mediaUrl / fileUrl Parameter Keys (CWE-22)

Description:

Summary

A path traversal vulnerability in the agent sandbox enforcement allows a sandboxed agent to read arbitrary files from other agents' workspaces by using the mediaUrl or fileUrl parameter key in message tool calls. The normalizeSandboxMediaParams function only checks ["media", "path", "filePath"] keys, while mediaUrl and fileUrl escape normalization entirely. Combined with handlePluginAction dropping mediaLocalRoots from the dispatch context, this enables a full sandbox escape where any agent can read files outside its designated sandbox root.

Details

The vulnerability exists in two files within the messaging pipeline:

1. Incomplete parameter key coverage in `normalizeSandboxMediaParams`:

In src/infra/outbound/message-action-params.ts, the function iterates over a hardcoded allowlist of parameter keys to validate:

// Line 212
const mediaKeys: Array<"media" | "path" | "filePath"> = ["media", "path", "filePath"];

The mediaUrl and fileUrl parameter keys are not included in this array. These keys are actively used by multiple channel extensions (Discord, Telegram, Slack, Matrix, Twitch) for media attachment handling, but they completely bypass the sandbox path validation performed by resolveSandboxedMediaSource.

2. Dropped `mediaLocalRoots` in `handlePluginAction`:

In src/infra/outbound/message-action-runner.ts, the handlePluginAction function dispatches actions to channel plugins but omits mediaLocalRoots from the context:

// Lines 684-697
const handled = await dispatchChannelMessageAction({
    channel,
    action,
    cfg,
    params,
    accountId: accountId ?? undefined,
    requesterSenderId: input.requesterSenderId ?? undefined,
    sessionKey: input.sessionKey,
    sessionId: input.sessionId,
    agentId,
    gateway,
    toolContext: input.toolContext,
    dryRun,
    // mediaLocalRoots is MISSING here
});

Despite ChannelMessageActionContext defining mediaLocalRoots?: readonly string[] (in src/channels/plugins/types.core.ts line 478), plugins receive undefined and fall back to getDefaultMediaLocalRoots(), which permits reads of the entire ~/.openclaw/ directory tree — including all agents' workspaces.

Attack chain:

  1. A sandboxed agent (Agent-A at ~/.openclaw/workspace/agent-a/) calls the message tool with { mediaUrl: "~/.openclaw/workspace/agent-b/secret.txt" }
  2. normalizeSandboxMediaParams skips the mediaUrl key (not in allowlist)
  3. handlePluginAction dispatches without mediaLocalRoots
  4. Plugin calls loadWebMedia with default roots, which allows ~/.openclaw/workspace/**
  5. Agent-B's secret file content is read and sent as a channel attachment

PoC

Prerequisites:

  • Docker installed
  • OpenClaw Docker image built (openclaw-gateway:latest)

Steps:

  1. Start the vulnerable gateway container:
cd llm-enhance/cve-finding/Path_Traversal/CVE-2026-27522-Media_Root_Bypass-variant-exp/
docker compose up -d
sleep 5
  1. Run the exploit:
python3 poc_exploit.py
  1. The exploit writes a secret file to ~/.openclaw/workspace/agent-b/secret_key.txt inside the container, then invokes normalizeSandboxMediaParams with Agent-A's sandbox policy and { mediaUrl: <agent-b-secret-path> }. The mediaUrl key bypasses normalization, and loadWebMedia reads the file successfully.
  1. Run the control experiment to confirm sandbox works for checked keys:
python3 control-sandbox_enforced.py

Log of Evidence

Exploit output:

=== CVE-2026-27522 Variant: Sandbox Media Root Bypass ===

[*] Container 'openclaw-media-bypass-test' is running
[*] Running exploit script with Bun...

[VULNERABLE] mediaUrl bypassed normalizeSandboxMediaParams!
  Agent-A sandboxRoot: /root/.openclaw/workspace/agent-a
  mediaUrl targets Agent-B: /root/.openclaw/workspace/agent-b/secret_key.txt
  args after normalization: {"mediaUrl":"/root/.openclaw/workspace/agent-b/secret_key.txt"}
[EXPLOITED] Agent-B secret file content: AGENT-B-SECRET-API-KEY-sk-12345abcdef

=== EXPLOIT SUCCESSFUL ===
Agent-A read Agent-B's secret file via mediaUrl, bypassing sandbox.

[+] RESULT: VULNERABLE — mediaUrl bypasses sandbox enforcement

Control experiment output:

=== Control Experiment: Sandbox Enforcement for 'media' Key ===

[*] Container 'openclaw-media-bypass-test' is running
[*] Running control script with Bun...

[SAFE] normalizeSandboxMediaParams blocked 'media' key as expected!
  Error: Path escapes sandbox root (/tmp/sandbox-ZKvGQX): /tmp/victim-2cuAOO/secret.txt

=== CONTROL EXPERIMENT PASSED ===
The 'media' parameter IS correctly checked by sandbox enforcement.
Only unchecked keys (mediaUrl, fileUrl) bypass the sandbox.

[+] CONTROL PASSED: 'media' key is correctly enforced by sandbox

Impact

This is a sandbox escape vulnerability. An attacker who can influence an agent's tool calls (via prompt injection, multi-agent interaction, or malicious plugin instruction) can read arbitrary files from other agents' workspaces. This includes:

  • API keys and secrets stored in other agents' sandboxes
  • Session data and conversation logs
  • Configuration files with sensitive credentials
  • Any file within the ~/.openclaw/ directory tree

This completely defeats the purpose of the multi-agent sandbox isolation feature, which is documented as a security boundary in the project's Docker and sandboxing documentation.

Affected products

  • Ecosystem: npm
  • Package name: openclaw
  • Affected versions: <= 2026.3.14 (current latest)
  • Patched versions:

Severity

  • Severity: High
  • Vector string: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

Weaknesses

  • CWE: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

Occurrences

| Permalink | Description |
| [https://github.com/moltbot/moltbot/blob/main/src/infra/outbound/message-action-params.ts#L206-L227](https://github.com/moltbot/moltbot/blob/main/src/infra/outbound/message-action-params.ts#L206-L227) | The `normalizeSandboxMediaParams` function with incomplete `mediaKeys` allowlist — `mediaUrl` and `fileUrl` are not checked. |
| [https://github.com/moltbot/moltbot/blob/main/src/infra/outbound/message-action-runner.ts#L684-L697](https://github.com/moltbot/moltbot/blob/main/src/infra/outbound/message-action-runner.ts#L684-L697) | The `handlePluginAction` dispatch call that omits `mediaLocalRoots` from the context passed to `dispatchChannelMessageAction`. |
| [https://github.com/moltbot/moltbot/blob/main/src/channels/plugins/types.core.ts#L478](https://github.com/moltbot/moltbot/blob/main/src/channels/plugins/types.core.ts#L478) | The `ChannelMessageActionContext` type that defines `mediaLocalRoots` but never receives it from `handlePluginAction`. |

Credited to YLChen-007.

Questions

Is this the same as the earlier media root bypass?

The report calls it a variant of an earlier media-root issue. The earlier fix covered the media, path and filePath keys. This one covers mediaUrl and fileUrl, which were still unchecked.

What does the attacker need?

The ability to influence an agent's tool calls, for example by prompt injection or a malicious plugin instruction. CVSS lists low privileges, network access and a changed scope.

Which version fixes CVE-2026-35668?

OpenClaw 2026.3.24. Anything older is affected per the package 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