#38

Security fixes from the Nov 28 audit

Opensahiljagtap08wants to merge intofrom

Fixes from a review of drumsd, the pool, the Windows/Android backends, the installer, CI and infra. One commit per area.

Fixed

Critical / high

  • Android shell action was host root. It ran as su 0 inside a privileged redroid container. Now refused unless the pool sets android.agent_shell: true (the study config opts in for oracle steps). The key action's argument is quoted.
  • Windows state id was spliced into a shell command run as root. QEMU's exec: migration URI goes through /bin/sh. Ids must match [A-Za-z0-9_-]{1,64}, and the paths are quoted.
  • Windows guests could reach the host's loopback (drumsd and other desktops' unauthenticated guest servers) through QEMU's host alias. The user net is now restrict=on by default (windows.restrict_net); no current Windows task needs internet.
  • Any pool client could act as admin. The admin token defaulted to the client token, so a client could register a host with token_file set to a real host's token file and a URL of its choice, and the pool would send that token there. Registration and drain now need admin_token_file, token_file must be <host_token_dir>/<name>.token, and a draining host with live envs can't be replaced.
  • Pool path traversal: /v1/slots/{id}/..%2F..%2F... reached other drumsd routes with the host token. Only drumsd's per-env ops are forwarded now.
  • Privileged setup steps ran without the env's seccomp filter or capability bounding set. They now get both, and drumsd refuses them when kernel.yama.ptrace_scope is 0, because the agent shares the step's uid and could ptrace it. install.sh sets it to 1.

Medium

  • Replies from an env's guest server (64 MiB) and pool upstream replies (128 MiB) are capped, where before they were buffered without limit in root daemons.
  • Task downloads go only over http(s) to public addresses, including on redirects: no file://, metadata, loopback or private ranges.
  • verify-release.sh refuses a missing signature unless --allow-unsigned is given (v0.2.2 only), and --tag pins the signing identity to one tag. Docs give the cosign command so users can verify without the downloaded script.
  • All workflow actions are pinned to commit SHAs.
  • Pool hosts get a per-host API token on first boot, and the AMI no longer carries the builder's token. The security group allows only ssh and 7070 between members.
  • Tenant VMs: VMM binaries are checked against pinned sha256 values (they match the T4 run's binaries), and source addresses are checked on each tap.
  • The env seccomp blocklist adds io_uring_* and userfaultfd.

Low

  • A forgotten slot dir is sealed 0700 root:root.
  • The Python proxy holds its netns fd, so a reused pid can't redirect it.
  • POST /v1/slots/:id/task runs the unsupported-task checks.
  • State ids are validated up front.
  • egress.py validates its inputs.
  • No more curl | sh or fixed /tmp paths.

No secrets were found in the tree or in git history.

Config changes for operators

  • A pool that registers or drains hosts through the API needs admin_token_file, holding a token different from token_file.
  • An Android pool that uses the shell action needs android.agent_shell: true.
  • Windows tasks that need internet need windows.restrict_net: false.
  • Pool and drumsd tokens must be at least 32 characters.

Tested

  • Linux (arm64 container): cargo test --workspace passes, and so does python/tests/test_sharedos_rootfs (176 tests).
  • clippy (-D warnings) is clean on aarch64 and x86_64, and fmt is clean.
  • The pool SDK tests pass against drums-sdk 0.4.0 (14 tests, 3 of them new: admin token, token_file paths, op allowlist).
  • The verify-release and install one-pass tests pass, and so do the osw tests.
  • The step seccomp program is checked with a BPF interpreter on both architectures. Loading it was tested on arm64 only, because the x86_64 emulator can't load any seccomp filter; CI's x86_64 runners cover the load.
  • verifier_sandbox fails in a container on untouched main too. It needs the root CI job.

Not yet run on a real Drums host. Before releasing, check on one host that Chrome and the apps still start with io_uring and userfaultfd blocked, that sudo setup steps still pass with the bounding set, and that the Windows tasks pass with restrict_net.

Known, not fixed here

  • redroid still runs --privileged on Docker's default bridge, and the emulator console has no auth token.
  • A nested user namespace (which Chrome's sandbox needs) gets a full bounding set over namespaces it creates.
  • crashwatch can be made to blame neighbouring episodes for crashes it can't attribute.
  • Two concurrent captures with the same name can collide (reliability only).
  • v0.2.2 has not been re-released signed.