/

CVE-2026-35668

Severity:

HIGH RISK

(7.7)

Path Traversal in OpenClaw Sandbox Media URL Handling

CVE-2026-35668

Analyzed

Vulnerability type

Category:

Path Traversal / Directory Traversal

CWE:

CWE-22

Impact:

Unauthorized File Read / Sandbox Escape (Read-Only)

Severity:

HIGH RISK

(7.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenClaw before 2026.3.24 contains a path traversal flaw in its sandbox enforcement logic that lets sandboxed agents read files outside their permitted workspace.

By abusing unnormalized mediaUrl or fileUrl parameters and gaps in sandbox root validation, an attacker-controlled agent can access arbitrary files from other agents' workspaces, including sensitive configuration and API key material.

Affected context

This vulnerability arises in OpenClaw deployments that use sandboxed agents with separated workspaces and rely on mediaUrl or fileUrl parameters for media or file access.

It affects code paths that invoke normalizeSandboxMediaParams to enforce sandbox boundaries but do not correctly validate or reconstruct paths against mediaLocalRoots or equivalent sandbox root context.

The risk is elevated when agent workspaces contain secrets such as API keys, access tokens, or environment-specific configuration files.

Exploit preconditions

  • Attack surface: Interfaces (APIs, queues, or control planes) that allow an attacker to run or control a sandboxed agent and influence mediaUrl / fileUrl values.
  • Required access: Ability to submit or modify tasks, jobs, or agent configurations such that the agent processes attacker-controlled mediaUrl or fileUrl parameters.
  • Trigger point: Any code path that calls normalizeSandboxMediaParams or related media/file access helpers without strict normalization and root checks, eventually resolving local file paths.
  • Why exploitation is possible:
  • Paths derived from mediaUrl / fileUrl are insufficiently normalized.
  • Validation logic does not robustly prevent .., absolute paths, or crafted encodings from escaping the intended sandbox root.
  • Missing or incomplete mediaLocalRoots context means the system cannot reliably enforce "stay under this directory" constraints.
  • The sandbox relies on application-level path checks rather than a fully enforced OS-level or container-level isolation boundary for file reads.

Why this happens

The underlying bug is a classic path traversal issue where user-controllable parameters are turned into file system paths without strict normalization and containment checks.

In OpenClaw, normalizeSandboxMediaParams is expected to enforce sandbox boundaries but does not fully sanitize or canonicalize the mediaUrl / fileUrl input before using it to locate files.

Additionally, missing or misapplied mediaLocalRoots context means the code cannot reliably assert that the resolved path stays within a designated sandbox root directory.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where an attacker supplies crafted path components (e.g., directory traversal sequences or encoded variants) that bypass naive validation and reach files outside the intended directory tree.

Potential impact

  • Access to other agents' workspace files, including logs, artifacts, or intermediate data.
  • Exposure of API keys, secrets, and configuration files stored within or adjacent to agent workspaces.
  • Discovery of environment-specific details (endpoints, credentials, feature flags) that could support broader compromise.
  • Violation of multi-tenant isolation promises, enabling a noisy neighbor to read another tenant's data.
  • Potential chaining with other flaws (e.g., if sensitive files contain tokens usable for remote access or privilege escalation elsewhere).

General mitigation guidance

Effective mitigation focuses on robust path handling and stronger sandbox boundaries rather than ad hoc filters on input parameters.

Path handling and validation patterns:

  • Convert all incoming path-like data from mediaUrl / fileUrl into canonical, absolute paths before validation, resolving symbolic links where feasible.
  • Enforce a strict "must be under this directory" policy by checking that the canonical path has the sandbox root as its prefix, rejecting any path that escapes this root.
  • Reject or ignore paths containing traversal patterns (.., ambiguous separators) or malformed encodings, rather than attempting partial cleanup.
  • Prefer constructing paths from vetted identifiers (IDs, handles) mapped to known locations instead of accepting arbitrary relative or absolute paths from clients.

Sandbox and privilege patterns:

  • Maintain clear, explicit mediaLocalRoots (or equivalent) for each agent or tenant, and ensure all file access helpers receive and enforce this context.
  • Run agents with least-privilege file system access so that, even if logic fails, the process cannot read outside its designated directories.
  • Avoid co-locating high-value secrets in the same file system namespace as agent workspaces; use dedicated secret stores or separate mounts with tighter ACLs.
  • Treat all agent-supplied URLs and file parameters as untrusted input, applying the same scrutiny as external user input.

How teams detect issues like this

Organizations can detect this class of issue through a combination of code-level analysis and runtime monitoring.

Static and code review approaches:

  • Search for direct or indirect usage of mediaUrl, fileUrl, or similar parameters that are passed to file APIs (open, read, stat) or media handlers.
  • Flag any code that constructs file paths from user-controlled pieces without:
  • Canonicalization (e.g., using platform-specific realpath/resolution), and
  • An explicit check that the resulting path is under a defined sandbox root.
  • Review implementations of normalizeSandboxMediaParams and related helpers to ensure they:
  • Operate on canonical paths,
  • Use configured mediaLocalRoots for containment checks, and
  • Fail closed (rejecting input) on abnormal path patterns.
  • Apply static analysis rules or security linters that detect suspicious concatenation of untrusted input with file system paths.

Runtime and operational approaches:

  • Configure logs to capture suspicious mediaUrl / fileUrl values (e.g., containing .., unusual encodings, or absolute paths) for anomaly detection.
  • Monitor file access logs or OS-level audit trails for agents reading outside their expected workspace directories.
  • Integrate automated security tests or fuzzers that supply crafted path values to APIs handling media or files, verifying they cannot escape sandbox roots.

Sources

SourceLink
github.comgithub.com/openclaw/openclaw/security/advisories/GHSA-hr5v-j9h9-xjhg
vulncheck.comvulncheck.com/advisories/openclaw-sandbox-media-root-bypass-via-unnormalized-mediaurl-and-fileurl-parameters

Frequently asked

questions

Exploitability depends on how easily an attacker can cause a sandboxed agent to process custom mediaUrl or fileUrl parameters. In multi-tenant or user-driven agent environments where tasks are submitted programmatically, this can often be done remotely by any actor allowed to run or configure agents.

Typically no special OS-level privileges are required. The attacker needs logical access to control or influence a sandboxed agent's inputs. Once obtained, the agent's own file system privileges are abused to read files outside its designated workspace.

Implement strict, centralized path canonicalization and root containment checks for all file access derived from URLs or user input, anchored on explicit sandbox root directories. Ensure helpers like normalizeSandboxMediaParams enforce these rules and fail closed on any ambiguous or non-conforming path.

Design sandboxed components with layered defenses: treat all path parameters as untrusted, enforce canonical "stay within root" checks, run agents with minimal file system permissions, and store secrets outside agent-accessible directories. Incorporate static analysis and security review gates that specifically look for path traversal patterns before deployment.

Find out what's already
exploitable in your codebase.