|
|||||||||||
|
Re: COSEINC Linux Advisory #1: Linux Kernel Parent Process Death Signal Vulnerability
From: Glynn Clements <glynn(at)gclements.plus.com>
Date: Wed Aug 15 2007 - 21:18:53 EDT Dan Yefimov wrote: > > > If setuid program just And that's the bug, because it's an unprivileged process which *causes* the signal to be issued. If the process tried to send the signal directly with kill(), it would fail. This vulnerability is a form of privilege escalation; it can cause the sending of signal which would normally be prohibited on security grounds. > Well written program must not depend on anything that is out of That's neither possible nor sensible. Programs have to rely upon the OS to guarantee certain behaviours. The problem here is that there is a mechanism which causes a guarantee to be violated. > > Also, other signals which could be triggered by the predecessor (e.g. Just in case it hasn't sunk in yet, the inability to trust signals is a consequence of this bug. Ordinarily, it should be possible to rely upon the fact that an asynchronous signal cannot be sent to a suid process by an unprivileged user. > > Also, if it's possible to set the signal to one which cannot be However nice failsafe may be, it is often either impossible or impractical. In general, a process shouldn't have to protect itself against the superuser, and in some respects shouldn't even try to. > > > From another hand, Are you talking about the parent exec()ing or the child? If you're talking about the parent, it isn't the parent's "successor" (the exec()d program which inherits the parent's PID) which gets the signal. If you're talking about the child, that would almost entirely defeat the purpose of having PDEATHSIG. A parent uses this feature to cause a signal to be delivered to its children when it terminates. The children will usually be created by fork()+exec(), so resetting it upon exec() would mean that it was only useful for the fork()-without-exec() case, which is quite uncommon. > But in any case, every program shouldn't trust any signal in the In which case, what's the point of having signals in the first place? Processes are supposed to respond to signals. Security is achieved placing controls on who can signal who, and this bug circumvents that mechanism. > I still don't see why this bug should be considered as a security issue but not Because it's a form of privilege escalation. Non-root processes can't normally send signals to processes which are owned by another UID (and most modern operating systems prevent non-root processes from sending signals to any process where suid/sgid is involved regardless of the current UID or EUID). > > Moreover, I would suggest that exec()ing a suid/sgid binary should POSIX, XPG, SUS.
Descriptors are preserved across exec() unless the FD_CLOEXEC flag is set. http://www.opengroup.org/onlinepubs/009695399/functions/execve.html File descriptors open in the calling process image shall remain open in the new process image, except for those whose close-on- exec flag FD_CLOEXEC is set. For those file descriptors that remain open, all attributes of the open file description remain unchanged. For any file descriptor that is closed for this reason, file locks are removed as a result of the close as described in close(). Locks that are not removed by closing of file descriptors remain unchanged. > Does blocked signal bitmap fall into it? Yes. >From the above link: The initial thread of the new process shall inherit at least the following attributes from the calling thread:
> What exactly are you going to reset? Everything which is not specified as being preserved. Which means every non-standard extension that programmers won't have heard of and won't be expecting to have to manually reset. -- Glynn ClementsReceived on Thu Aug 16 16:05:08 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 28 2007 - 06:12:20 EDT |
||||||||||
|
|||||||||||