[UNIX] Subdreamer SQL Injection

From: SecuriTeam (support_at_securiteam.com)
Date: 03/22/05

  • Next message: SecuriTeam: "[NEWS] Buffer Overflow In Soldier Of Fortune II"
    To: list@securiteam.com
    Date: 22 Mar 2005 17:39:17 +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

    - - - - - - - - -

      Subdreamer SQL Injection
    ------------------------------------------------------------------------

    SUMMARY

    "Powered by PHP and MySQL, <> Subdreamer provides the ability to create
    dynamic websites while giving full control over every section of the site.
    A powerful content management system with an amazing skin engine which
    provides users with unique and cool looking skins."

    Due to flaws in the way the program filters incoming data the Subdreamer
    program can be made to include arbitrary SQL statement into its existing
    statement.

    DETAILS

    Insufficient filtering of user input data can lead to SQL injection
    vulnerability, if the magic_quotes_gpc has been set to zero, this is due
    to the fact that some global arrays are not driven through addslashes()
    function.

    Vulnerable code in script includes/core.php:
    if(!get_magic_quotes_gpc()) // add slashes if gpc is off
    {
      $_POST = AddSlashesArray($_POST);
      $_GET = AddSlashesArray($_GET);
      $_COOKIE = AddSlashesArray($_COOKIE);
    --[/script includes/core.php]--

    As you can see the script's functions variables are defined as "global",
    not from global POST or GET arrays. This can lead to inadequate filtering
    if register_global has been set to one.

    Vulnerable code in script includes/core.php:
    if(function_exists('ini_get'))
    {
      $globalsoption = ini_get('register_globals');
    }
    else
    {
      $globalsoption = get_cfg_var('register_globals');
    }
    if($globalsoption != 1)
    {
      @extract($HTTP_SERVER_VARS, EXTR_SKIP);
      @extract($HTTP_COOKIE_VARS, EXTR_SKIP);
      @extract($HTTP_POST_FILES, EXTR_SKIP);
      @extract($HTTP_POST_VARS, EXTR_SKIP);
      @extract($HTTP_GET_VARS, EXTR_SKIP);
      @extract($HTTP_ENV_VARS, EXTR_SKIP);
      @extract($HTTP_SESSION_VARS, EXTR_SKIP);
    }

    In this case an attacker can cause an SQL injection attack through the
    variables that are defined as global in the function.

    Example:
    If we look into the vulnerable script
    plugins/p17_image_gallery/imagegallery.php:
    function p17_DisplayImages($sectionid, $start)
    {
      global $DB;
      global $categoryid;
      global $p17_imageid;
     [...]
     if(isset($p17_imageid))
     {
     $image = $DB->query_first("SELECT * FROM p17_images WHERE imageid =
    '$p17_imageid'");
     [...]
     <td style="padding-top: 20px;" align="center"><img
    src="plugins/p17_image_gallery/images/'.$image['filename'].'" /></td>

    You can notice that if we use the following URL we can cause an SQL
    injection vulnerability.
    http://example/index.php?categoryid=3&p17_sectionid=1&p17_imageid=[SQL
    attack code]

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:foster@ghc.ru> GHC team.

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

    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: "[NEWS] Buffer Overflow In Soldier Of Fortune II"

    Relevant Pages

    • [UNIX] PHPNuke Multiple Vulnerabilities in Search Module
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... cross-site scripting and SQL injections located throughout the ... The vulnerability exists in the ... The first SQL injection vulnerability is a non-critical one in the ...
      (Securiteam)
    • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
      (Securiteam)
    • [UNIX] SCO Multiple Local 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 ... Local exploitation of a buffer overflow vulnerability in the ppp binary, ... allows attackers to gain root privileges. ...
      (Securiteam)
    • [NT] Microsoft Word 6.0/95 Document Converter Buffer Overflow (MS04-041)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WordPad is "a word processing application that uses the MFC rich edit ... Remote exploitation of a buffer overflow vulnerability in Microsoft ... Microsoft Word format files into the Rich Text Format natively handled by ...
      (Securiteam)
    • [UNIX] Tikiwiki Command Injection and Arbitrary File Exposure Vulnerabilities
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Two security vulnerabilities have been recently discovered in Tikiwiki, ... Remote exploitation of an input validation vulnerability in Tikiwiki ... allows attackers to gain access to arbitrary files on the vulnerable ...
      (Securiteam)