https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295052
--- Comment #16 from Jan Bramkamp <[email protected]> --- I think the closefrom() before execve() inside of run_command() makes it harder to exploit the fd leak, but is no complete mitigation. Given a jail that has two or more exec.start/exec.stop hooks an attacker inside the jail (e.g. a malicious rc.d script) can guess the likely pids of new processes attaching to its jail and try to debug them before they reach closefrom(). While attaching to a jail partially protects a process against unwanted debugging by setting P_SUGID until it gets cleared by a call to execve() or fexecve() this only protects it from being debugged by unprivileged processes which would fail anyways because processes necessarily attach to a jail as root. To pass the p_candebug() check in ptrace (and procfs) an attacker needs to have PRIV_DEBUG_SUGID which the jail's root has by default. If my analysis is correct the bug is still exploitable and every jail start/stop grants the attacker new attempts to win the race. -- You are receiving this mail because: You are on the CC list for the bug.
