Discuz!论坛程序moderation.inc.php页面存在数据库'注射'缺陷


添加时间:
2008-12-09

系统编号:
WAVDB-01267

影响版本:
Discuz! 6.0.0-6.1.0

程序介绍:

Crossday Discuz! Board 论坛系统(简称 Discuz! 论坛)是一个采用 PHP 和 MySQL 等其他多种数据库构建的高效论坛解决方案。作为商业软件产品, Discuz! 在代码质量,运行效率,负载能力,安全等级,功能可操控性和权限严密性等方面都在广大用户中有良好的口碑。凭借 Discuz! 开发组长期积累的丰富的 web 开发及数据库经验,和强于创新,追求完美的设计理念,使得 Discuz! 在很短时间内以其鲜明的个性特色从国内外同类产品中脱颖而出。经过了效率最优化和负载能力最佳化设计的 Discuz! ,已获得业内越来越多专家和权威企业的认可。

漏洞分析:

在文件include/moderation.inc.php里代码:

 
  1. $threadlist = $loglist = array();  
  2. if($tids = implodeids($moderate)) {  
  3.  $query = $db->query("SELECT * FROM {$tablepre}threads WHERE tid IN ($tids) AND fid='$fid' AND displayorder>='0' AND digest>='0' LIMIT $tpp");  
  4.  while($thread = $db->fetch_array($query)) {  
  5.   ...  
  6.   $threadlist[$thread['tid']] = $thread;  
  7.   ...  
  8.    foreach($threadlist as $tid => $thread) {  
  9.     ...  
  10.      if($type == 'redirect') {  
  11.       $db->query("INSERT INTO {$tablepre}threads (fid, readperm, iconid, author, authorid, subject, dateline, lastpost, lastposter, views, replies, displayorder, digest, closed, special, attachment)  
  12.        VALUES ('$thread[fid]''$thread[readperm]''$thread[iconid]''".addslashes($thread['author'])."''$thread[authorid]''".addslashes($thread['subject'])."''$thread[dateline]''$thread[dblastpost]''$thread[lastposter]''0''0''0''0''$thread[tid]''0''0')");  

 

这个比较明显,从数据库查询出的值$thread[lastposter]直接带入了insert语句中,导致了注射
这个看上去比上面的那个用处大些,其实有很多的限制.首先$thread[lastposter]是从数据库中查询出来的值,有字数限制[不能大于15个字符];其次,这个地方需要版主权限才能操作.



漏洞利用:

注册新用户,用户名为80vul',发表新回复,然后用拥有版主权限的账号将此帖转移,移动方式选为[移动主题并在原来的版块中保留转向],和上面的效果一样,执行时数据库报错

解决方案:
厂商补丁:
Discuz!
-------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://www.discuz.net/

信息来源:
<*
80vul
http://www.80vul.com/dzvul/sodb/08/sodb-2008-08.txt
*>