From 6db999f18491431228f738cc86204c25d2d02109 Mon Sep 17 00:00:00 2001 From: aiqubits Date: Tue, 1 Sep 2026 15:10:29 +0800 Subject: [PATCH] Clear set-ID bits from Windows VM mount sources --- bin/omarchy-windows-vm | 2 +- test/shell.d/windows-vm-mount-boundary-test.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/omarchy-windows-vm b/bin/omarchy-windows-vm index f672ed7eee1d..dba9333315aa 100755 --- a/bin/omarchy-windows-vm +++ b/bin/omarchy-windows-vm @@ -580,7 +580,7 @@ prepare_caller_mounts() { # Privacy is an explicit preflight step for both already-pinned sources, not # a side effect halfway through the two-mount transaction. Old umask-022 # installs are hardened together before either Docker-facing anchor changes. - chmod 0700 -- "/proc/$BASHPID/fd/$storage_fd" "/proc/$BASHPID/fd/$shared_fd" || { + chmod a-s,u=rwx,go= -- "/proc/$BASHPID/fd/$storage_fd" "/proc/$BASHPID/fd/$shared_fd" || { exec {storage_fd}<&- exec {shared_fd}<&- return 1 diff --git a/test/shell.d/windows-vm-mount-boundary-test.sh b/test/shell.d/windows-vm-mount-boundary-test.sh index 13623d816456..57542e7ecd3f 100644 --- a/test/shell.d/windows-vm-mount-boundary-test.sh +++ b/test/shell.d/windows-vm-mount-boundary-test.sh @@ -87,11 +87,13 @@ TEST_PASSWD_HOME=/home/alice resolve_caller || fail "valid root PKEXEC_UID/home boundary was rejected" pass "root dispatch rejects missing/invalid uid, passwd, owner, symlink, and writable-parent boundaries without mutation" -# Put each familiar source on its own filesystem. Both start with legacy 0755 -# permissions and world-readable payloads to prove migration hardens the leaves. +# Put each familiar source on its own filesystem. Both start with legacy 2755 +# permissions and world-readable payloads to prove migration clears set-ID bits +# while hardening the leaves. mkdir /home/storage-target /home/shared-target mount -t tmpfs -o uid=1000,gid=1000,mode=0755,size=3g storage-test /home/storage-target mount -t tmpfs -o uid=1000,gid=1000,mode=0755,size=64m shared-test /home/shared-target +chmod 2755 /home/storage-target /home/shared-target ln -s /home/storage-target /home/alice/.windows ln -s /home/shared-target /home/alice/Windows chown -h 1000:1000 /home/alice/.windows /home/alice/Windows @@ -103,6 +105,8 @@ chmod 0644 /home/storage-target/disk.img /home/shared-target/shared.txt home_dev=$(command stat -Lc '%d' /home/alice) storage_dev=$(command stat -Lc '%d' /home/storage-target) [[ $home_dev != "$storage_dev" ]] || fail "storage target did not land on a separate filesystem" +[[ $(command stat -Lc '%u:%a' /home/storage-target) == 1000:2755 && + $(command stat -Lc '%u:%a' /home/shared-target) == 1000:2755 ]] || fail "test sources did not start with setgid permissions" with_vm_lock prepare_caller_mounts || fail "root could not create verified production bind anchors" resolve_caller