Richard Gooch SimpleInit Open File Descriptor Vulnerability
BID:5001
Info
Richard Gooch SimpleInit Open File Descriptor Vulnerability
| Bugtraq ID: | 5001 |
| Class: | Design Error |
| CVE: |
CVE-2002-0767 |
| Remote: | No |
| Local: | Yes |
| Published: | Jun 12 2002 12:00AM |
| Updated: | Jul 11 2009 01:56PM |
| Credit: | Credited to Patrick Smith <[email protected]>. |
| Vulnerable: |
Richard Gooch simpleinit 2.0.2 Alvaro Lopes wmnetmon 0.2 p4-gnomepanelsupport Alvaro Lopes wmnetmon 0.2 p3 Alvaro Lopes wmnetmon 0.2 p2 Alvaro Lopes wmnetmon 0.2 p1 Alvaro Lopes wmnetmon 0.2 |
| Not Vulnerable: |
Alvaro Lopes wmnetmon 0.2 p5 |
Discussion
Richard Gooch SimpleInit Open File Descriptor Vulnerability
A vulnerability has been reported for simpleinit that may allow users to execute arbitrary commands as the superuser.
The vulnerability occurs because simpleinit may allow some child processes to inherit a file descriptor with read-write access. The file descriptor is used to access /dev/initctl and this descriptor is normally used by 'initctl', 'need' and 'provide' programs to pass instructions to simpleinit. The simpleinit process runs with root privileges.
A local user whose process inherits this file descriptor will be able to cause simpleinit to execute commands as the superuser.
A vulnerability has been reported for simpleinit that may allow users to execute arbitrary commands as the superuser.
The vulnerability occurs because simpleinit may allow some child processes to inherit a file descriptor with read-write access. The file descriptor is used to access /dev/initctl and this descriptor is normally used by 'initctl', 'need' and 'provide' programs to pass instructions to simpleinit. The simpleinit process runs with root privileges.
A local user whose process inherits this file descriptor will be able to cause simpleinit to execute commands as the superuser.
Exploit / POC
Richard Gooch SimpleInit Open File Descriptor Vulnerability
The following exploit has been provided by Patrick Smith <[email protected]>:
The following exploit has been provided by Patrick Smith <[email protected]>:
Solution / Fix
Richard Gooch SimpleInit Open File Descriptor Vulnerability
Solution:
An unofficial patch has been provided by Patrick Smith <[email protected]>:
--- login-utils/simpleinit.c.orig 2001-09-29 11:09:10.000000000 -0400
+++ login-utils/simpleinit.c 2002-05-23 22:16:07.000000000 -0400
@@ -203,6 +203,18 @@
if ( ( initctl_fd = open (initctl_name, O_RDWR, 0) ) < 0 )
err ( _("error opening fifo\n") );
}
+ if ( initctl_fd >= 0 )
+ if ( fcntl (initctl_fd, F_SETFD, FD_CLOEXEC) != 0 ) {
+ err ( _("error setting close-on-exec on /dev/initctl") );
+ /* Can the fcntl ever fail? If it does, and we leave
+ the descriptor open in child processes, then any
+ process on the system will be able to write to
+ /dev/initctl and have us execute arbitrary commands
+ as root. So let's refuse to use the fifo in this
+ case. */
+ close(initctl_fd);
+ initctl_fd = -1;
+ }
if ( want_single || (access (_PATH_SINGLE, R_OK) == 0) ) do_single ();
Currently we are not aware of any vendor-supplied patches for this issue. If you feel we are in error or are aware of more recent information, please mail us at: [email protected] <mailto:[email protected]>.
Alvaro Lopes wmnetmon 0.2 p1
Alvaro Lopes wmnetmon 0.2 p2
Alvaro Lopes wmnetmon 0.2 p3
Alvaro Lopes wmnetmon 0.2 p4-gnomepanelsupport
Alvaro Lopes wmnetmon 0.2
Solution:
An unofficial patch has been provided by Patrick Smith <[email protected]>:
--- login-utils/simpleinit.c.orig 2001-09-29 11:09:10.000000000 -0400
+++ login-utils/simpleinit.c 2002-05-23 22:16:07.000000000 -0400
@@ -203,6 +203,18 @@
if ( ( initctl_fd = open (initctl_name, O_RDWR, 0) ) < 0 )
err ( _("error opening fifo\n") );
}
+ if ( initctl_fd >= 0 )
+ if ( fcntl (initctl_fd, F_SETFD, FD_CLOEXEC) != 0 ) {
+ err ( _("error setting close-on-exec on /dev/initctl") );
+ /* Can the fcntl ever fail? If it does, and we leave
+ the descriptor open in child processes, then any
+ process on the system will be able to write to
+ /dev/initctl and have us execute arbitrary commands
+ as root. So let's refuse to use the fifo in this
+ case. */
+ close(initctl_fd);
+ initctl_fd = -1;
+ }
if ( want_single || (access (_PATH_SINGLE, R_OK) == 0) ) do_single ();
Currently we are not aware of any vendor-supplied patches for this issue. If you feel we are in error or are aware of more recent information, please mail us at: [email protected] <mailto:[email protected]>.
Alvaro Lopes wmnetmon 0.2 p1
-
Alvaro Lopes wmnetmon-0.2p5.tar.gz
http://www.alvie.com/download/wmnetmon/wmnetmon-0.2p5.tar.gz
Alvaro Lopes wmnetmon 0.2 p2
-
Alvaro Lopes wmnetmon-0.2p5.tar.gz
http://www.alvie.com/download/wmnetmon/wmnetmon-0.2p5.tar.gz
Alvaro Lopes wmnetmon 0.2 p3
-
Alvaro Lopes wmnetmon-0.2p5.tar.gz
http://www.alvie.com/download/wmnetmon/wmnetmon-0.2p5.tar.gz
Alvaro Lopes wmnetmon 0.2 p4-gnomepanelsupport
-
Alvaro Lopes wmnetmon-0.2p5.tar.gz
http://www.alvie.com/download/wmnetmon/wmnetmon-0.2p5.tar.gz
Alvaro Lopes wmnetmon 0.2
-
Alvaro Lopes wmnetmon-0.2p5.tar.gz
http://www.alvie.com/download/wmnetmon/wmnetmon-0.2p5.tar.gz
References
Richard Gooch SimpleInit Open File Descriptor Vulnerability
References:
References:
- simpleinit Boot Scripts (Richard Gooch)
- WMNetMon Home Page (Alvaro Lopes)