|
|||||||||||
|
Re: COSEINC Linux Advisory #1: Linux Kernel Parent Process Death Signal Vulnerability
From: Glynn Clements <glynn(at)gclements.plus.com>
Date: Thu Aug 16 2007 - 15:37:23 EDT Dan Yefimov wrote: > > > The signal in question in the given situation is issued by PRIVILEGED process, All of these are known, documented behaviours. The signals involved can be blocked or ignored, and the mechanisms which send those signals can be disabled (tcsetattr() can disable Ctrl-C etc, unused descriptors can be closed, timers can be reset, etc). Setuid programs will normally take such steps at startup if they have critical sections which should avoid being interrupted (e.g. to prevent stale lock files). However, the bug in question allows sending signals which cannot be blocked or ignored (SIGKILL, SIGSTOP). Moreover, the cause (PDEATHSIG) cannot be disabled, and will be unknown to to programmers who aren't familiar with the Linux-specific prctl() call (and even programmers who know about it won't be allowing for the fact that it could be triggered by an unprivileged process due to this bug). > Yes, all they can be turned off, but that would Such is life for anyone writing a setuid executable. However, the issues are known and documented. At least, most of them are; but not the PDEATHSIG issue. > It's much simpler for that program to just block, ignore or install SIGKILL and SIGSTOP cannot be blocked, handled or ignored. Signals which don't terminate the process may still have undesirable consequences, e.g. use of SIGUSR1 as a secure signalling mechanism (at least, it's supposed to be secure). > > because it's an unprivileged process which Including setuid children. That isn't supposed to be possible. > And Killing a process can leave stale lock files resulting in a denial of service. Sending SIGSTOP may behave likewise, only moreso: the creator will still exist, so the lock files may not be considered stale, fcntl() locks will still be held, etc. There's more risk if a program uses signals (e.g. SIGUSR1) for remote control. If there wasn't *any* risk, there wouldn't be any restrictions on sending signals to privileged processes. > > > Well written program must not depend on anything that is out of That interferes with any existing passwd invocation. > > Programs have to rely upon the It's roughly as exploitable as any other bug which allows signals to be sent to privileged processes, i.e. it's mostly a DoS issue. > > Just in case it hasn't sunk in yet, the inability to trust signals is You cannot protect against the superuser, nor should you even try. Programs which attempt to evade control by the owner of the hardware are normally termed "malware". > > > In fact, PDEATHSIG should be reset for every binary, not just suid/sgid, since Sure it does. Server subprocesses frequently start with exec(), whether of a different binary or the same binary. The latter is sometimes done to reset memory usage. But the more general case is simply where a process wants all of its children to die with it. If the parent is killed, the children are typically of no further use, and may at least tie up resources and possibly prevent a new invocation of the parent from operating. > > > But in any case, every program shouldn't trust any signal in the It's obliged to "repsond" to SIGKILL and SIGSTOP, and may choose to respond to other signals under the assumption that there are restrictions on who can send them. > > > I still don't see why this bug should be considered as a security issue but not Sending asynchronous signals to setuid/setgid children is supposed to be impossible, and that restriction is considered a security mechanism. > > > > Moreover, I would suggest that exec()ing a suid/sgid binary should No. I'm suggesting that it should be possible for a setuid/setgid program to *exhaustively* sanitise (or at least validate) its operating environment. -- Glynn ClementsReceived on Thu Aug 16 16:41:23 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 28 2007 - 06:12:22 EDT |
||||||||||
|
|||||||||||