/

CVE-2026-42074

Severity:

CRITICAL RISK

(9.8)

Improper Access Control on Sandbox Configuration (CWE-284) in OpenClaude BashTool

CVE-2026-42074

Analyzed

Vulnerability type

Category:

Improper Access Control / Sandbox Escape

CWE:

CWE-284, CWE-306

Impact:

Remote Code Execution via Sandbox Escape

Severity:

CRITICAL RISK

(9.8)

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

OpenClaude exposes a sandbox-disabling flag (dangerouslyDisableSandbox) directly in the BashTool input schema, allowing the LLM itself to toggle sandboxing behavior.

When combined with the default allowUnsandboxedCommands: true setting, a prompt-injected model can disable the sandbox and execute arbitrary commands on the host, resulting in full code execution risk.

Affected context

This vulnerability affects OpenClaude setups where:

  • The BashTool is enabled and available to the LLM agent
  • The dangerouslyDisableSandbox flag is part of the tool input schema
  • allowUnsandboxedCommands is set to true (the default in affected versions)
  • The LLM is treated as an untrusted or semi-trusted principal and can be influenced by user prompts or external content

In such contexts, the LLM can modify its own tool inputs to disable sandboxing at runtime, undermining the host protection model.

Exploit preconditions

  • Attack surface: LLM tool-use interface exposed through OpenClaude's command line or integrated environments.
  • Required access: Ability to provide prompts or content that the LLM processes; no direct shell access is required.
  • Trigger point: Any BashTool invocation where the LLM controls or can influence the dangerouslyDisableSandbox field while allowUnsandboxedCommands remains true.
  • Why exploitation is possible: Sandbox controls are modeled as regular, writable tool inputs instead of being enforced as out-of-band policy or configuration, allowing an untrusted LLM to elevate its own execution capabilities.

Why this happens

The core issue is a misplacement of trust and control over security-critical configuration.

A parameter intended to guard execution safety (dangerouslyDisableSandbox) is exposed as part of the BashTool input schema, which is directly controlled by the LLM agent.

This maps to CWE-284: Improper Access Control, because an untrusted principal can change a high-privilege security setting, and is also related to CWE-306 where proper enforcement of operational restrictions is missing in practice.

Rather than enforcing sandbox boundaries as immutable, host-controlled policy, the design treats them as data-level fields that any tool_use response may set, enabling a prompt-injected or compromised model to disable isolation and run arbitrary commands on the host.

Potential impact

  • Full remote code execution on the host machine running OpenClaude
  • Execution of arbitrary shell commands with the privileges of the OpenClaude process
  • Reading, modifying, or deleting local files accessible to the OpenClaude runtime
  • Exfiltration of credentials, API keys, SSH keys, and other secrets present on the system
  • Use of the compromised host as a pivot point for lateral movement within a network
  • Manipulation or poisoning of local development environments, build artifacts, or source code

General mitigation guidance

Effective mitigation focuses on separating security policy from LLM-controlled inputs and enforcing sandboxing at a layer the model cannot directly modify.

Recommended defensive patterns include:

  • Treat sandbox flags and execution policies as trusted configuration, not as tool parameters; they should be set by operators or configuration files, not by the model.
  • Encapsulate command execution behind a strict policy engine that validates requested operations against allowlists or high-level capabilities instead of raw shell access.
  • Apply a default-deny stance for unsandboxed commands; require explicit, out-of-band approval or configuration to allow them.
  • Run the command execution subsystem under least-privilege OS accounts, with constrained file-system and network permissions to reduce impact if boundaries fail.
  • Introduce explicit human-in-the-loop approval for high-risk actions where sandboxing would otherwise be bypassed or weakened.
  • Clearly separate "dangerous" operations into distinct tools or workflows that are only available in hardened or interactive contexts, not in unattended agent runs.

How teams detect issues like this

Detection can rely on both code-centric and runtime-oriented approaches:

  • Static analysis / configuration review:
  • Search for security-critical flags (e.g., sandbox toggles, debug bypasses) appearing in tool schemas, model-facing APIs, or any data structures influenced by LLM output.
  • Flag patterns where security controls are represented as ordinary, user- or model-writable fields rather than as configuration or environment-level settings.
  • Review YAML/JSON schemas for tools to ensure that fields impacting isolation, authentication, or authorization are not model-controlled.
  • Code review signals:
  • Attention points where tool invocation structs are populated directly from LLM responses without a policy gate.
  • Any code path where a boolean or enum governing sandbox/unsafe execution is assigned based solely on model output.
  • Runtime monitoring:
  • Log and monitor when sandbox-disabling flags are toggled or when unsandboxed execution paths are taken.
  • Alert on unexpected spikes in shell command volume, file-system access, or network activity originating from the LLM agent process.
  • Automated tooling:
  • Use security linters or custom rules in CI pipelines to detect exposure of sensitive configuration in public tool schemas.
  • Incorporate policy-as-code checks (e.g., Open Policy Agent or similar) to ensure sandbox rules are enforced independently of LLM behavior.

Sources

SourceLink
github.comgithub.com/Gitlawb/openclaude/commit/aab489055c53dd64369414116fe93226d2656273
github.comgithub.com/Gitlawb/openclaude/pull/778
github.comgithub.com/Gitlawb/openclaude/security/advisories/GHSA-m77w-p5jj-xmhg

Frequently asked

questions

Yes. In typical usage, an attacker only needs remote access to the interface that accepts prompts for the LLM. By crafting prompts that influence the model to set dangerouslyDisableSandbox and issue shell commands, they can achieve host-level code execution without direct system access.

The attacker needs the ability to provide content that the LLM processes—this might be via a CLI session, API, chat interface, or any integration wired to OpenClaude. They do not need shell credentials or direct access to OpenClaude configuration files.

Move all sandbox and execution-policy controls out of the LLM-controlled data path and into operator-managed configuration or policy layers. The model should never be able to directly toggle sandboxing; instead, the host enforces non-bypassable, least-privilege execution rules regardless of model output.

Treat the LLM as an untrusted component: never allow it to set or modify security-critical options. Design tools so that:

  • Security and privilege boundaries are enforced independently of model output.
  • Dangerous capabilities are explicitly gated by policy, configuration, or human review.
  • Tool schemas expose only operational parameters, not flags that weaken isolation, authentication, or authorization.
Find out what's already
exploitable in your codebase.