########################## WwW.BugReport.ir ###########################################
#
#      AmnPardaz Security Research & Penetration Testing Group
#
# Title: RunCms Multiple Vulnerabilities
# Vendor: http://www.runcms.org/
# Bugs: Local File Inclusion, Modules Authorization Weakness
# Vulnerable Version: RunCMS 1.6 Halloween, 1.5.x (prior versions also may be affected)
# Exploitation: Remote with browser
# Exploit: Available
# Fix Available: No!
#######################################################################################


Description:
--------------------
RunCMS is a comprehensive content management system (CMS) where ease of use,
speed, & flexibility are the main development key points.
RunCMS is a CMS coming from the cores of E-Xoops. E-Xoops 1.05r3 was the last version with the E-Xoops name.

Vulnerabilities:
--------------------
+-->Local File Inclusion (Remote Code Execution)

Code Snippet:

/include/common.php line#131-143

// ################# :: Register Globals Compatibility :: #################
$globals_test = @ini_get('register_globals');
if (isset($globals_test) && empty($globals_test))
{
   // These still need some work :: Cookie|Server|Env are ok now.
   if ( !empty($HTTP_GET_VARS) )  { extract($HTTP_GET_VARS, EXTR_SKIP);  }
   if ( !empty($HTTP_POST_VARS) ) { extract($HTTP_POST_VARS, EXTR_SKIP); }
   define('_GLOBALS', FALSE);
}
else
{
   define('_GLOBALS', TRUE);
}

/include/common.php line#276-280

// ################ Include page-specific lang file ##################
if (isset($xoopsOption['pagetype']))
{
   rc_include_lang_file($xoopsOption['pagetype'].".php");
}

$xoopsOption['pagetype'] is not defined by default, so it's possible for an attacker to define
it by both $_GET or $_POST methods to conduct Local file inclusion!
Furthermore RunCms doesn't properly validate the content of user supplied Uploads!
Attacker could upload php codes with .gif extension and include it using above vulnerability!

POC: http://localhost/runcms_1.6/modules/news/?xoopsOption[pagetype]=../../images/avatar/users/[uid].gif%00