sandlock
sandlock copied to clipboard
procfs: /proc/self/root and symlinks bypass every path-based open filter
With -r /proc, the open handlers match the path string the child wrote and return Continue; the kernel resolves links afterwards.
cat /proc/1/cmdline -> Permission denied
cat /proc/self/root/proc/1/cmdline -> /sbin/init splash (host pid 1)
cat /proc/self/root/etc/hostname -> real hostname, not the virtual one
grep -c : /proc/self/root/proc/net/dev -> all host interfaces, not just lo
A symlink in any writable directory (ln -s /proc/1/cmdline /tmp/x) works the same way. This defeats the per-PID /proc filter, the sensitive-path deny, and the /proc, /etc/hosts and /etc/hostname virtualization. It is an information leak, not a Landlock escape: the target must still be readable under the policy.
Proposed fix: decide on the resolved target rather than the written string, either by resolving before filtering or by serving /proc and /etc opens on behalf of the child (open, check the real path of the fd, inject it), as the fs_deny path already does.