Skip to main content

Module security

Module security 

Source
Expand description

Process-level hardening against the /proc/<pid>/environ side channel.

build_shell_env (see shell.rs) sanitizes the environment array handed to each spawned subprocess, but that only covers the array Command passes at execve time. It does nothing about a bash child reading its own parent’s raw kernel-recorded environment via /proc/$PPID/environ — a channel entirely outside Command’s control. Marking the runtime process non-dumpable closes that channel: the kernel’s ptrace_may_access check (which gates /proc/pid/environ reads) fails for a non-dumpable target even when the reader shares the same UID.

Functions§

harden_process_dumpable
Marks the current process non-dumpable so no same-UID process — including its own shell descendants — can read this process’s /proc/<pid>/environ.