GitHub Advisoryadvisory · PyPI, npm, Go, crates.io

GHSA-g6ww-w5j2-r7x3 BoxLite: Permission Bypass Allows Modification of Read-Only Files

CRITICAL Published 2026-05-21 Modified 2026-06-12 Official page ↗
Aliases
CVE-2026-46695
Ecosystem
PyPI, npm, Go, crates.io
Packages
boxlite, @boxlite-ai/boxlite, github.com/boxlite-ai/boxlite/sdks/go, boxlite-cli
Severity
Critical
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N
Weaknesses
CWE-284
Reviewed
2026-05-21

Affected packages

• PyPI boxlite: < 0.9.0 → fixed in 0.9.0 • npm @boxlite-ai/boxlite: < 0.9.0 → fixed in 0.9.0 • Go github.com/boxlite-ai/boxlite/sdks/go: < 0.9.0 → fixed in 0.9.0 • crates.io boxlite: < 0.9.0 → fixed in 0.9.0 • crates.io boxlite-cli: < 0.9.0 → fixed in 0.9.0

Description

Summary Boxlite is a sandbox service that allows users to create lightweight virtual machines (Boxes) and launch OCI containers within them to run untrusted code. One of the core security features claimed by Boxlite is the ability to mount host directories in read-only mode (read_only=True) into the VM via the virtiofs protocol (a host-guest shared filesystem protocol designed specifically for virtual machines), so that untrusted code can only read but not modify host data. Since the underlying function of the lightweight VM library libkrun used by Boxlite does not support mounting in read-only mode, Boxlite chooses to implement read-only by adding the MS_RDONLY flag when mounting the directory after the VM starts. However, because Boxlite does not restrict the kernel capabilities available inside the container, malicious code can remount the directory in rw mode, thereby gaining write access to that directory. This allows malicious code to perform arbitrary write operations on directories that should be read-only. In typical usage scenarios of Boxlite, an attacker can leverage this vulnerability to gain code execution capability on the host. For example, in AI Agent scenarios, user code, virtual environments, credentials, configuration files, and other content are often mounted in read-only mode into the container. Malicious code inside the sandbox can modify this information, such as planting malicious code, to gain code execution capability on the host, which may further introduce supply chain risks. Details 1. User-Facing API Documents Read-Only Guarantee File: `boxlite/src/runtime/options.rs` Function: `VolumeSpec` (line 223) Code: ```rust /// Filesystem mount specification. pub struct VolumeSpec { pub host_path: String, pub guest_path: String, pub read_only: bool, // BoxliteResult { let host_path_c = CString::new(host_path) .map_err(|e| BoxliteError::Engine(format!("invalid host path: {e}")))?; let mount_tag_c = CString::new(mount_tag) .map_err(|e| BoxliteError::Engine(format!("invalid mount tag: {e}")))?; check_status("krun_add_virtiofs", unsafe { krun_add_virtiofs(self.ctx_id, mount_tag_c.as_ptr(), host_path_c.as_ptr()) // No read_only parameter — libkrun exposes the share as read-write to the guest }) } ``` Issue: `krun_add_virtiofs` in the FFI (`deps/libkrun-sys/src/lib.rs:35`) takes only `ctx_id`, `mount_tag`, and `host_path`. There is no read-only flag. Libkrun exposes the virtiofs share to the guest with full read-write access at the device level. 4. Read-Only Enforcement Is Delegated to Guest Agent (Zone 0) File: `boxlite/src/volumes/guest_volume.rs` Function: `build_guest_mounts()` (line 184) Code: ```rust for entry in &self.fs_shares { let mount_point = entry.guest_path.as_deref().unwrap_or(""); volumes.push(VolumeConfig::virtiofs( &entry.tag, mount_point, entry.read_only, // i32; // No krun_add_virtiofs_ro or equivalent declared } ``` Issue: There is no alternative read-only virtiofs FFI function declared. The entire codebase has no `krun_add_virtiofs_ro` or read-only parameter variant. Enforcement at the hypervisor level does not exist. 6. OCI Spec Builder Grants All Capabilities File: `guest/src/container/capabilities.rs` Function: `all_capabilities()` (line 19) Code: ```rust pub fn all_capabilities() -> HashSet { [ // ... Capability::SysModule, // 16: load/unload kernel modules Capability::SysRawio, // 17: perform I/O port operations Capability::SysAdmin, // 21: various admin operations Capability::NetAdmin, // 12: network administration Capability::NetRaw, // 13: use RAW/PACKET sockets Capability::MacOverride, // 32: override MAC Capability::Bpf, // 39: BPF operations // ... all 41 capabilities ] .into_iter() .collect() } ``` Issue: Returns all 41 capabilities including the most dangerous ones, like `Capability::SysAdmin`. The function comment itself says "maximum compatibility but reduced security isolation." PoC 1. Install Boxlite following the official tutorial. 2. Run the following Python script: ```python import asyncio import os import tempfile import sys from boxlite import Boxlite, BoxOptions async def run(box, cmd): """Run shell command via native box.exec API.""" execution = await box.exec("sh", ["-c", cmd], None) stdout_stream = execution.stdout() stderr_stream = execution.stderr() stdout_lines, stderr_lines = [], [] async def read_stdout(): async for line in stdout_stream: stdout_lines.append(line if isinstance(line, str) else line.decode('utf-8', errors='replace')) async def read_stderr(): async for line in stderr_stream: stderr_lines.append(line if isinstance(line, str) else line.decode('utf-8', errors='replace')) await asyncio.gather(read_stdout(), read_stderr()) result = await execution.wait() return { 'exit_code': result.exit_code, 'stdout': ''.join(stdout_lines), 'stderr': ''.join(stderr_lines), } async def main(): # Step 1: Set up host directory with a read-only file host_dir = tempfile.mkdtemp(prefix="virtiofs_ro_poc_") ro_file = os.path.join(host_dir, "read_only.txt") with open(ro_file, "w") as f: f.write("original content\n") print(f"[+] Step 1: Host directory created: {host_dir}") print(f" read_only.txt: {open(ro_file).read().strip()}") print() guest_mount = "/mnt/sensitive" print(f"[+] Step 2: Launching BoxLite VM with:") print(f" volumes=[('{host_dir}', '{guest_mount}', True)] # read_only=True") print() try: runtime = Boxlite.default() opts = Box…

Related

Alias · CVE (1)

  • CVE-2026-46695 Boxlite is a sandbox service that allows users to create lightweight virtual machines (Boxes) and launch OCI containers within them to run… vulnerability

Weakness · CWE (1)

  • CWE-284 Improper Access Control weakness

References