Matthias Gerstner 161f85b98b fix CVE-2025-46805: socket.c - don't send signals with root privileges
The CheckPid() function was introduced to address CVE-2023-24626, to
prevent sending SIGCONT and SIGHUP to arbitrary PIDs in the system. This
fix still suffers from a TOCTOU race condition. The client can replace
itself by a privileged process, or try to cycle PIDs until a privileged
process receives the original PID.

To prevent this, always send signals using the real privileges. Keep
CheckPid() for error diagnostics. If sending the actual signal fails
later on then there will be no more error reporting.

It seems the original bugfix already introduced a regression when
attaching to another's user session that is not owned by root. In this
case the target sessions runs with real uid X, while for sending a
signal to the `pid` provided by the client real uid Y (or root
privileges) are required.

This is hard to properly fix without this regression. On Linux pidfds
could be used to allow safely sending signals to other PIDs as root
without involving race conditions. In this case the client PID should
also be obtained via the UNIX domain socket's SO_PEERCRED option,
though.
2025-05-12 15:38:19 +02:00
2022-01-06 03:23:32 +02:00
2005-12-15 16:11:20 +00:00
Description
Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells
9.9 MiB
Languages
C 76.7%
Roff 14.1%
PostScript 6%
Shell 1.4%
Makefile 1.1%
Other 0.7%