[UNIX] BOOZT! Administration CGI Vulnerable to Buffer Overflow

From: support@securiteam.com
Date: 01/08/02


From: support@securiteam.com
To: list@securiteam.com
Date: Tue,  8 Jan 2002 21:08:00 +0100 (CET)

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

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  BOOZT! Administration CGI Vulnerable to Buffer Overflow
------------------------------------------------------------------------

SUMMARY

 <http://www.boozt.com/> BOOZT! is a banner management software for Linux
servers. A security vulnerability in the product allows remote attackers
to execute arbitrary code, by exploiting a buffer overflow vulnerability
in the CGI.

DETAILS

Example:
Here is a reproduction of the bug:
http://127.0.0.1:8080/cgi-bin/boozt/admin/index.cgi?section=5&input=1

Fill the "Name Field" with enough A's (over 770 A's) and press "Create New
Banner". You should see the following:

Internal Server Error

The server encountered an internal error or mis-configuration and was
unable to complete your request.

Let us see what happened in error_log:

[Tue Feb 5 17:13:52 2002] [error] [client 127.0.0.1] Premature end of
script headers: /usr/local/apache/cgi-bin/boozt/admin/index.cgi

Now see what the code for the AdministrationBanners function
(src/admin/banners.c) looks like:

         char name[255]="";

         [...]

        if ((pomus=(char *)GetFromCgi("name"))==NULL) strcpy(name,"");
        else strcpy(name,pomus);

There is no boundary checking in GetFromCgi:

        #define GetFromCgi(name) cgiParam(name)

        const char *cgiParam(const char *name)
        {
         return cgiPosParam((CgiPos*)listGetByName(name));
        }

        const char *cgiPosParam(CgiPos *where)
        {
         CgiElement *w=(CgiElement*)where;
         DefCheck(NULL);

         [ ... code to walk over the linked list ... ]
        }

This way we can write custom shellcode beyond the boundaries of the "name"
variable, getting a shell with HTTPd privileges.

ADDITIONAL INFORMATION

The information has been provided by <mailto:rsanmcar@alum.uax.es> Rafael
San Miguel Carrasco.

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

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.



Relevant Pages