Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!


TUCoPS :: Macintosh :: b06-4795.htm

Apple Remote Desktop root vulneravility



Apple Remote Desktop root vulneravility
Apple Remote Desktop root vulneravility



Background:=0D
ARD allows unix commands to be remotely sent from an admin workstation. These commands can be run as root, because the ard administrator can be given sudo access. This exploit involves sending a unix command as root to install a package that was copied to /tmp/. In this case, the app is Adobe CS 2.0 using the adobe silent installation script. The script will mount disk images as root, run the install, then cleanup. If a standard user is logged in, they will see an icon on the dock for the install, but should never see anything besides the icon.=0D
=0D
The issue:=0D
The process LoginWindow is owned by the logged in user. If the  system is at the login window, then the process LoginWindow is owned by root. If the system is mounting a disk image visible only to root, then the image will try to appear on the desktop. Clicking the mouse will force the desktop to appear, as well as the menus. A user sitting that the system will then see a finder window, and the root users home directory. The login window can be ignored, and the user has full root access. Files can be deleted without authentication, and the trash can be emptied. If a user tries to login, the login window will check their credentials, but they will end up logging in to the root desktop with root privileges.=0D
=0D
The workaround:=0D
If you are trying to run a remote install script such as the Adobe Silent installer, use the lock screen feature in ARD. This locks the users desktop until the admin is done doing their thing.=0D
=0D
The end result:=0D
http://www.flickr.com/photos/metfoo/246858852/=0D 
=0D
Adobes script:=0D
#!/bin/sh=0D
#=0D
# Example script to run the Adobe Creative Suite 2 Installer silently.=0D
#=0D
#=0D
# Copyright: 2005 Adobe Systems, Inc.=0D
#=0D
# =0D
=0D
=0D
function detach_images=0D
{=0D
	# umount any previous mounted installer images=0D
	for NUMBER in 1 2 3 4=0D
	do=0D
		MOUNTED_POINT="/Volumes/Adobe Creative Suite Disk ${NUMBER} "=0D
		/sbin/mount |/usr/bin/grep "${MOUNTED_POINT}" 2>/dev/null =0D
		if [ $? -eq 0 ] ; then=0D
			echo "Another \"${MOUNT_POINT}\" already attached."=0D
			DEVICE=`/sbin/mount |/usr/bin/grep "${MOUNTED_POINT}" 2>/dev/null |/usr/bin/cut -d" " -f1`=0D
			if [ -b "${DEVICE}" ] ; then=0D
				/usr/bin/hdiutil detach "${DEVICE}"	=0D
				echo "Detaching \"${DEVICE}\"..."=0D
			fi=0D
		fi=0D
	done=0D
}=0D
=0D
=0D
SAVEDIR="`pwd`"=0D
trap 'cd "${SAVEDIR}"' EXIT=0D
=0D
=0D
if [ $# -ne 2 ] ; then=0D
	echo "usage: $0  "=0D
	exit 1=0D
fi=0D
=0D
IMGDIR=$1=0D
CONFIG=$2=0D
=0D
=0D
# Check OS Version, Minimum is 10.2.8=0D
OSVERSION=`/usr/bin/sw_vers |/usr/bin/grep ProductVersion |/usr/bin/cut -d: -f2`=0D
MAJORVER=`echo ${OSVERSION} | /usr/bin/cut -d . -f2`=0D
MVTEMP=`echo ${OSVERSION} | /usr/bin/cut -d. -f3`=0D
MINORVER=${MVTEMP:-0}=0D
=0D
if [ ${MAJORVER} -lt 3 ] ; then=0D
	# if less then 10.3=0D
	if [ ${MAJORVER} -ne 2 ] ; then=0D
			echo "This version of MacOS (${OSVERSION}) is not supported."=0D
			exit 1;=0D
	else        =0D
		if [ ${MINORVER} -lt 8 ] ; then=0D
			echo "This version of MacOS (${OSVERSION}) is not supported."=0D
			exit 1;=0D
        fi              =0D
    fi=0D
	HDIUTIL_OPTIONS==0D
else=0D
	# additional hdiutil options for 10.3 or above system	=0D
	HDIUTIL_OPTIONS="-private -noverify"=0D
fi=0D
=0D
=0D
# Check root volume is HFS =0D
/sbin/mount -t hfs |/usr/bin/grep " / " 2>/dev/null=0D
if [ $? -ne 0 ] ; then=0D
	echo "Root volume is not a HFS volume." =0D
	exit 5=0D
fi=0D
=0D
# validate the arguments =0D
if [ ! -d "$IMGDIR" ] ; then=0D
	echo "$IMGDIR" does not exist. =0D
	exit 2=0D
fi=0D
=0D
=0D
if [ ! -r "$CONFIG" ] ; then=0D
	echo "$CONFIG" does not exist. =0D
	exit 3=0D
fi=0D
=0D
=0D
# Check running as  root=0D
MYUID=`/usr/bin/id -u`=0D
=0D
if [ ${MYUID} -ne 0 ] ; then=0D
	echo "You need to be root to run the Adobe Creative Suite 2 Installer."=0D
	exit 4=0D
fi=0D
=0D
=0D
cd "${IMGDIR}"=0D
IMGCOUNT=`/bin/ls -l *.dmg 2>/dev/null | /usr/bin/wc -l`=0D
if [ -z "${IMGCOUNT}" -o "${IMGCOUNT}" = "0" ] ; then=0D
	echo "No disk image found in "${IMGDIR}"." =0D
	exit 2=0D
fi=0D
=0D
#detach any already attached installer images=0D
detach_images=0D
=0D
# Mount the disk images for the installer CDs=0D
for DMG in *.dmg=0D
do=0D
	# mount the remaining disk images=0D
	echo=0D
	echo "--- Attaching Installer disk image ${NUMBER}..."=0D
	echo /usr/bin/hdiutil attach -verbose -readonly ${HDIUTIL_OPTIONS} "${DMG}"=0D
	/usr/bin/hdiutil attach -verbose -readonly ${HDIUTIL_OPTIONS} "${DMG}"=0D
=0D
	if [ $? -ne 0 ] ; then=0D
		echo "Error in attaching installer disk image: \"${DMG}\""=0D
		exit 6=0D
	fi=0D
done=0D
=0D
echo=0D
echo=0D
echo "---- Starting the Adobe Creative Suite Installer..."=0D
echo=0D
"/Volumes/Adobe Creative Suite Disk 1/Adobe Installer.app/Contents/MacOS/Adobe Installer" --batch -c "${CONFIG}"=0D
INSTALLATION_RESULT=$?=0D
echo=0D
=0D
#now detach attached installer images=0D
detach_images=0D
=0D
exit ${INSTALLATION_RESULT}=0D


TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH