GHSA-g6ww-w5j2-r7x3 BoxLite: Permission Bypass Allows Modification of Read-Only Files
SummaryBoxlite 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.DetailsUser-Facing API Documents Read-Only Guarantee**File:** `boxlite/src/runtime/options.rs` **Function:** `VolumeSpec` (line 223) **Code:****Issue:** The `read_only` field is documented (and in user-facing guides) as preventing the guest from writing to the host directory. The guarantee is "Agent can read but not write." This expectation is not met.read_only Stored in FsShare — Passed to krun Without Enforcement**File:** `boxlite/src/vmm/krun/engine.rs` **Function:** `Krun::create()` (line 334) **Code:****Issue:** `share.read_only` is logged as "ro" or "rw" but is never passed to `add_virtiofs`. The actual hypervisor call receives only tag and host path.Hypervisor FFI Has No Read-Only Parameter**File:** `boxlite/src/vmm/krun/context.rs` **Function:** `add_virtiofs()` (line 423) **Code:****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.Read-Only Enforcement Is Delegated to Guest Agent (Zone 0)**File:** `boxlite/src/volumes/guest_volume.rs` **Function:** `build_guest_mounts()` (line 184) **Code:****Issue:** The `read_only` flag is sent to the guest agent via gRPC as a mount instruction. The guest agent is expected to pass `-o ro` to the mount syscall. But the guest runs Zone 0 code — untrusted, assumed malicious. A compromised or malicious guest simply ignores this instruction.FFI Declaration Confirms No Read-Only Variant Exists**File:** `boxlite/deps/libkrun-sys/src/lib.rs` **Function:** `krun_add_virtiofs` extern declaration (line 35) **Code:****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.OCI Spec Builder Grants All Capabilities**File:** `guest/src/container/capabilities.rs` **Function:** `all_capabilities()` (line 19) **Code:****Issue:** Returns all 41 capabilities including the most dangerous ones, like `Capability::SysAdmin`. The function comment itself says "maximum compatibility but reduced security isolation."PoCInstall Boxlite following the official tutorial.Run the following Python script:This script mounts a directory in read-only mode into the sandbox and attempts to exploit the vulnerability to modify a file in that directory. Expected output:ImpactMalicious code can 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.ScoreSeverity: Critical, Score: 10.0, rationale as follows:**AV:N** — Malicious code can be transmitted through networks, such as code written by large language models.**AC:L** — No special conditions or race conditions are required. The attacker simply executes a `mount -o remount,rw` command inside the container. `CAP_SYS_ADMIN` is granted by default, and the attack is deterministic and trivially reproducible.**PR:N** — The attacker needs the ability to execute arbitrary code inside the Boxlite sandbox, which is the fundamental use case of Boxlite (running untrusted code).**UI:N** — No user interaction is required. Malicious code inside the container can autonomously exploit this vulnerability without any action from the host operator.**S:C** — The vulnerability allows the attacker to cross the sandbox trust boundary and impact the host system. The vulnerable component is the Boxlite sandbox isolation mechanism, but the impacted component is the host filesystem.**C:H** — With write access to host directories, the attacker can plant malicious code that will be executed by the host, leading to full compromise of sensitive host data including credentials, API keys, user code, and configuration files mounted into the container.**I:H** — The attacker gains full write access to host directories explicitly intended to be read-only, allowing arbitrary modification of host files including planting backdoors, modifying virtual environments for supply chain attacks, and altering credentials and configuration files.**A:N** — The vulnerability primarily enables unauthorized write access. The host system and Boxlite service continue to function; no distinct availability impact mechanism exists beyond secondary consequences of write access.CreditThis vulnerability was discovered by:XlabAI Team of Tencent Xuanwu LabAtuin Automated Vulnerability Discovery EngineCVE and credit are preferred.If you have any questions regarding the vulnerability details, please feel free to reach out to us for further discussion. Our email address is xlabai@tencent.com.NoteNote that we follow the industry-standard **90+30 disclosure policy** (Reference: https://googleprojectzero.blogspot.com/p/vulnerability-disclosure-policy.html). This means that we reserve the right to disclose the details of the vulnerability 30 days after the fix has been implemented.ResolutionFixed in **v0.9.0** by PR #454 (commit `2c26968e`), released 2026-04-29, with defense-in-depth across three layers:**Hypervisor-level read-only enforcement.** virtio-fs shares are now created via `krun_add_virtiofs3` (libkrun v1.18.0) with the `read_only` flag passed through, so the share is read-only at the virtio-fs device — before any request reaches the guest kernel. A malicious guest `mount -o remount,rw` can no longer reach host data even if it regained `CAP_SYS_ADMIN`.**Capability restriction.** Containers now receive the 14 Docker-default capabilities, explicitly excluding `CAP_SYS_ADMIN` (and `CAP_NET_ADMIN`, `CAP_SYS_MODULE`, `CAP_SYS_RAWIO`, `CAP_MAC_OVERRIDE`), so the remount in the PoC fails with `EPERM`.**TSI network isolation.** When the network is disabled, the implicit vsock is replaced with an explicit vsock with no TSI features, closing a related guest→host socket-forwarding path.Regression coverage: `src/boxlite/tests/security_enforcement.rs` (Rust core) and `sdks/python/tests/test_readonly_volume_remount.py` (Python SDK) both replay the PoC remount attack and assert it fails.**Remediation:** upgrade to boxlite **0.9.0 or later** (all SDKs: PyPI `boxlite`, npm `@boxlite-ai/boxlite`, Go module `github.com/boxlite-ai/boxlite/sdks/go`, crates.io `boxlite` / `boxlite-cli`). There is no workaround for affected versions; upgrade is required.
CVSS v3.1 score: 10