ContentNow CMS 1.39 Sql Injection + Path Disclosure Vulnerabilities Severity : Medium risk Vendor : www.contentnow.mf4k.de Author : Alfredo 'revenge' Pesoli [--------------------------------------------------] [#] Description ContentNow is a PHP Content Management System web 2.0 compliant, more info can be found at vendor site. ContentNow v1.39 is vulnerable to a sql injection and path disclosure. [--------------------------------------------------] Vuln #1 : Sql Injection Impact : Admin credentials disclosure (Manipulation of data) Exploit : http://www.0xcafebabe.it/sploits/contentnow_139_sqlinj.pl The "pageid" parameter in "index.php" isn't properly sanitised before being used in a sql query, this can be exploited to manipulate existing SQL query by inserting arbitrary SQL code, which can disclose sensitive information like admin credentials. The problem is due to: [ index.php ] ... ... // get/set id or startpageid from config $pid = $_GET['pageid']; if (empty($pid) || $pid == 1) $pid = $cnEngine->configArray[0]['startpageid']; --> if (false == $cnEngine->checkPid($pid)) die (' Error loading site. No pid found.'); $cnEngine->setId($pid); ... ... [ function checkPid($pid) from /cn/library/class.engine.php ] ... ... function checkPid($pid) { $cnDatabase = NewADOConnection(ADODB_DB_TYPE); $cnDatabase->Connect(CN_DB_HOST, CN_DB_USER, CN_DB_PASSWORD, CN_DB_NAME); $sql = "SELECT pageid FROM ".CN_TBL_SECTIONS." WHERE pageid = ".$pid; $res = $cnDatabase->Execute($sql); if ($res->RecordCount() > 0) { return true; } else { return false; } } ... ... As you can see there's no input validation on "pageid" parameter. It is also possible to disclose the full path to index.php by requesting index.php?pageid=' [#] Solution Download 1.40 version. [#] Disclosure timeline 2006/11/20 Bugs discovered 2006/11/20 Vendor contacted 2006/11/21 Vendor response 2006/11/21 New version 1.40 patched 2006/11/22 Public Disclosure Alfredo 'revenge' Pesoli