Skip to content

Harden the host-side VMM for CLI runs: reuse the shuru-node jail on Linux, sandbox the process on macOS #11

Open

Description

Problem

Upstream 0.11.0 (pulled in by #3) adds crates/shuru-node (RFC 0008): each VM in its own jailed shuru-vmm process and the proxy in a jailed shuru-netd, with a seccomp allowlist installed on every thread before the first KVM_RUN, a deny list for the network process, unshare(CLONE_NEWCGROUP), capset to drop capabilities and PR_SET_NO_NEW_PRIVS (shuru-node/src/seccomp.rs, jail.rs).

That jail only applies to the hosted node runtime, driven by shuru-node run. The CLI path is untouched:

  • On Linux, shuru run still goes through shuru-vm → shuru-linux (see crates/shuru-vm/Cargo.toml target deps). shuru-node is not in default-members and nothing in shuru-cli, shuru-vm or shuru-linux references it. The VMM and proxy run as one unsandboxed process with the user's privileges.
  • On macOS there is no equivalent at all. shuru.entitlements grants the virtualization entitlement and nothing restricts filesystem or network access of the host process.

Firecracker runs under a jailer precisely because the VMM is the attack surface a guest escape lands on. A guest that breaks out of a CLI-launched shuru VM gets the full user account.

Proposed behaviour

Linux:

  • Make the CLI use the shuru-node jail (or the same seccomp::install_vmm / jail building blocks) for shuru run, not only for hosted nodes. Keep the one-process layout if the privileged opener is too much for the CLI, but at least install the seccomp allowlist and drop capabilities before KVM_RUN.
  • Add Landlock to restrict the process to the data dir, the mounted paths and /dev/kvm; RFC 0008 does not cover filesystem confinement beyond fd passing.

macOS:

  • Split the proxy (which needs network) from the VMM (which does not once vsock is up), or at least run the VMM under sandbox_init with a profile that denies network and limits filesystem access to the mount list.
  • Audit shuru.entitlements and keep only com.apple.security.virtualization.

This is the piece that makes shuru safe for untrusted input on a developer machine, not just on a hosted node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions