-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The read_only field was used to format a log line\n\nPre-patch, the mount loop in `src/boxlite/src/vmm/krun/engine.rs` looked like this:\n\n```rust\nfor share in config.fs_shares.shares() {\n let path_str = share.host_path.to_str().ok_or_else(|| {\n BoxliteError::Engine(format!(\"Invalid path: {}\", share.host_path.display()))\n })?;\n\n tracing::info!(\n \" {} → {} ({})\",\n share.tag,\n share.host_path.display(),\n if share.read_only { \"ro\" } else { \"rw\" }\n );\n ctx.add_virtiofs(&share.tag, path_str)?;\n}\n```\n\n`share.read_only` is read once, inside the `tracing::info!` macro, to choose between the literal string `\"ro\"` and the literal string `\"rw\"`. The next line calls `ctx.add_virtiofs(&share.tag, path_str)` with two arguments. The flag is not one of them.\n\nThe FFI binding `add_virtiofs` was calling has no third parameter to receive it. From `src/deps/libkrun-sys/src/lib.rs`:\n\n```rust\npub fn krun_add_virtiofs(\n ctx_id: u32,\n mount_tag: *const c_char,\n host_path: *const c_char,\n) -> i32;\n```\n\n`krun_add_virtiofs` accepts the context, the tag, the host path. That is the full surface. There is no read-only argument because the libkrun v1.16.0 function does not have one. The hypervisor mounts the virtio-fs share as read-write at the device level for every caller, because the device-level mode is whatever default libkrun picked, not what the operator requested.\n\nThe `read_only: bool` on `VolumeSpec` had the type signature of a boolean enforcement and the runtime behavior of a log decoration.\n\n## The enforcement was a mount instruction sent to the untrusted code\n\nRead-only on a virtio-fs share has two possible enforcement points. The hypervisor can expose the device read-only, in which case the guest kernel cannot write to it no matter what mount options it negotiates. Alternatively, the guest can mount the share with `-o ro`, in which case the guest kernel refuses writes through that mount point but the device underneath is still capable of receiving them.\n\nThe first is hardware-level enforcement. The second is the guest's kernel cooperating with the operator's intent.\n\nBoxLite, before 0.9.0, did the second. The flag was logged on the host, then re-emitted as a guest-side mount instruction. The guest agent received the instruction. The guest agent is Zone 0 code, the project's own term for the untrusted environment the sandbox exists to contain. Asking the untrusted code to mount its own filesystem read-only is identical to asking it to be honest about what it does next.\n\nThe patch imports the libkrun v1.18.0 FFI function the old binding did not have:\n\n```rust\npub fn krun_add_virtiofs3(\n ctx_id: u32,\n mount_tag: *const c_char,\n host_path: *const c_char,\n shm_size: u64,\n read_only: bool,\n) -> i32;\n```\n\n`krun_add_virtiofs3` has the parameter `krun_add_virtiofs` did not. The PR #454 diff that closes CVE-2026-46695 threads `share.read_only` through:\n\n```diff\n- ctx.add_virtiofs(&share.tag, path_str)?;\n+ ctx.add_virtiofs(&share.tag, path_str, share.read_only)?;\n```\n\n`ctx.add_virtiofs` itself gains the parameter and forwards it to the FFI. From the post-patch `src/boxlite/src/vmm/krun/context.rs`:\n\n```rust\ncheck_status(\"krun_add_virtiofs3\", unsafe {\n krun_add_virtiofs3(\n self.ctx_id,\n mount_tag_c.as_ptr(),\n host_path_c.as_ptr(),\n 0,\n read_only,\n )\n})\n```\n\nThis is enforcement on the host side of the hypervisor boundary. A guest with arbitrary kernel capabilities cannot remount a virtio-fs device read-write if the device is exposed read-only, because the writability is gated where the guest cannot see it. The fix is exactly the parameter the old code dropped.\n\n## The guest had all 41 capabilities. The comment above the function said it shouldn't.\n\nA read-write virtio-fs share is not, by itself, the bug. A guest mounting that share `-o ro` and respecting the option could still produce the read-only contract. The bug is the combination: the device is read-write, the guest is untrusted, and the guest has every capability needed to undo the guest-side restriction.\n\nPre-patch, `src/guest/src/container/capabilities.rs` opened with this:\n\n```rust\n//! Linux capabilities\n//!\n//! Single source of truth for all 41 Linux capabilities.\n//! Used by:\n//! - OCI spec builder (process.capabilities)\n//! - Tenant process spawning (exec capabilities)\n\nuse oci_spec::runtime::Capability;\nuse std::collections::HashSet;\n\n/// Get all 41 Linux capabilities as a HashSet\n///\n/// This is the single source of truth for capabilities in the system.\n/// Returns all capabilities for maximum compatibility.\n///\n/// # Security Note\n/// This provides maximum compatibility but reduced security isolation.\n/// For production, consider limiting to required capabilities only.\npub fn all_capabilities() -> HashSet {\n [\n // File operations (CAP 0-4)\n Capability::Chown,\n Capability::DacOverride,\n Capability::DacReadSearch,\n Capability::Fowner,\n Capability::Fsetid,\n // ... 31 more entries ...\n Capability::SysAdmin, // 21: various admin operations\n // ...\n```\n\nThe function is named `all_capabilities`. The doc comment names what it does. Above the body, the developer wrote a section titled `Security Note` and said, in their own words, that this set \"provides maximum compatibility but reduced security isolation\" and that \"for production, consider limiting to required capabilities only.\"\n\nThat note shipped to production on 9 December 2025, the repository's initial commit. It survived the workspace reorganization on 1 April 2026. It was still there when the XlabAI team at Tencent's Xuanwu Lab and the Atuin discovery engine landed the PoC. The function continued to return 41 capabilities including `CAP_SYS_ADMIN` for four months and twenty days, with the in-source instruction not to do that sitting three lines above the array literal.\n\nThis is the shape catalogued under [Todo That Shipped](/patterns/todo-that-shipped): a comment names the security-relevant fix, and the code below ships without it. The recent Drupal exhibit ([CVE-2026-9082](/posts/drupal-cve-2026-9082-the-comment-said-values)) is the variant where the control was written and a later refactor removed it. BoxLite's variant is the one where the developer wrote the `for production, consider limiting` recommendation in their own words on the day the project went public, and shipped it for the entire life of the codebase up to the CVE.\n\n`CAP_SYS_ADMIN` is what `mount -o remount,rw` requires. The patch replaces `all_capabilities()` with `default_capabilities()`, fourteen entries matching Docker's defaults, no `CAP_SYS_ADMIN`, no `CAP_NET_ADMIN`, no `CAP_SYS_MODULE`, no `CAP_BPF`.\n\n## The remount worked because nothing in the stack was enforcing\n\nThe PoC reduces to two commands inside the sandbox. Mount the host directory with `read_only=True` from the SDK side, then, from inside the guest:\n\n```sh\n$ echo pwned > /data/readonly/hack.txt\nsh: /data/readonly/hack.txt: Read-only file system\n$ mount -o remount,rw /data/readonly\n$ echo pwned > /data/readonly/hack.txt\n$ cat /data/readonly/hack.txt\npwned\n```\n\nThe first write fails because the guest agent mounted the share `-o ro` as instructed. The remount succeeds because the guest still holds `CAP_SYS_ADMIN`. The second write succeeds because the underlying virtio-fs device was always read-write at the host. The new content reaches the host directory's `hack.txt` because the share is, at the device level, a bidirectional channel.\n\nThe regression test the patch adds, in `src/boxlite/tests/security_enforcement.rs`, asserts the remount now fails:\n\n```rust\nasync fn readonly_volume_blocks_remount(bx: &LiteBox) {\n let (exit, output) = exec_full(\n bx,\n BoxCommand::new(\"sh\").args([\"-c\", \"mount -o remount,rw /data/readonly 2>&1\"]),\n )\n .await;\n assert_ne!(exit, 0, \"remount rw should fail without CAP_SYS_ADMIN\");\n assert!(\n output.contains(\"ermission denied\")\n || output.contains(\"peration not permitted\")\n || output.contains(\"not permitted\")\n || output.contains(\"EPERM\")\n || output.contains(\"Read-only\"),\n \"error should indicate permission/readonly denial, got: {output}\"\n );\n}\n```\n\nThe assertion fails closed via two distinct mechanisms in the new build. The dropped `CAP_SYS_ADMIN` makes the `remount` syscall return `EPERM` before it reaches the device. The device-level read-only flag on `krun_add_virtiofs3` would make the remount return `EROFS` if the capability were ever restored. Defense in depth, after the fact. Pre-patch, neither layer existed; the guest had the capability and the device was writable.\n\n## The README's promise\n\nThe repository's README, unchanged across the vulnerable window, sells the runtime to a specific audience. It addresses operators running language-model-generated code that, by hypothesis, can be adversarial. Two of the README's bullets read \"Full Freedom Inside\" and \"Hardware Isolation\"; the second specifies \"Each Box is a separate VM with its own kernel, not just namespaces.\" The marketing promise is that the inside-the-box adversary cannot reach the outside-the-box host, because the boundary is hardware.\n\nIn the implementation, the boundary was a log line and a mount option. The hypervisor was not enforcing read-only because the binding for the parameter did not exist. The guest was enforcing read-only because the guest, having every capability the kernel offers, was asked nicely.\n\nThis is [Setting Was Advisory](/patterns/setting-was-advisory) in its simplest form. The SGLang exhibit ([CVE-2026-7669](/posts/sglang-trust-remote-code-was-a-suggestion)) is the variant where the library flips the flag inside a wrapper. BoxLite's variant is one step less elaborate. The flag is never passed to the enforcement layer at all. The implementation's only acknowledgement that the flag exists is the `if share.read_only { \"ro\" } else { \"rw\" }` ternary inside the `tracing::info!` macro.\n\nCVE-2026-46695's CVSS vector is `AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N`. Scope changed, integrity high, confidentiality high, attack complexity low. The \"network\" attack vector is the LLM-generated input the sandbox was sold to contain. The \"privileges required: none\" reflects that the attacker is, by design, the workload.\n\nPoC: [GHSA-g6ww-w5j2-r7x3](https://github.com/boxlite-ai/boxlite/security/advisories/GHSA-g6ww-w5j2-r7x3)","closing_line":"The fix did not have to be authored. It had to be passed.","hook_md":"BoxLite is a sandbox runtime for untrusted code. Its README positions the product at AI agents that need to install packages, write files, and execute arbitrary programs, with the project's stated guarantee that \"nothing escapes to your host.\" Before version 0.9.0, the `read_only` field on the runtime's `VolumeSpec` had exactly one runtime effect: it decided whether the log line for a mounted share printed `ro` or `rw`. The flag was read once, formatted into a string, and dropped. The hypervisor mounted every share read-write. The guest, running code the project documents as untrusted, was handed all 41 Linux capabilities, including `CAP_SYS_ADMIN`, and asked politely to honor the read-only mount option itself. `mount -o remount,rw /data/readonly` worked. CVE-2026-46695, CVSS 10.0, GHSA-g6ww-w5j2-r7x3, patched on 29 April 2026.","post_id":436,"slug":"boxlite-cve-2026-46695-read-only-was-a-log-line","title":"CVE-2026-46695: BoxLite's read_only Flag Decided Whether the Log Said 'ro'. Nothing Else.","type":"initial","unreadable_sentence":"The `read_only: bool` on `VolumeSpec` had the type signature of a boolean enforcement and the runtime behavior of a log decoration."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCamZQOQAKCRDeZjl4jgkQ JlooAQCdlowwWpOECbXZ8ynbDLPeEr8covyENnE3DSt4F1H+2QD9H7yACyltA08d 0l0XP1amZVhGEAyHzS5kdSsgUegiCAs= =BGRW -----END PGP SIGNATURE-----