Bo-Blog个人博客系统注射漏洞


添加时间:
2009-05-08

系统编号:
WAVDB-01401

影响版本:
Bo-Blog 2.0.3

程序介绍:

Bo-Blog是一款基于PHP的、以MySQL为数据库支持的免费blog程序。

漏洞分析:

//inc/mod_tag.php
 

 
  1. if (!defined('VALIDREQUEST')) die ('Access Denied.');   
  2.   
  3. if (!$job$job='default';   
  4. else $job=basename($job);   
  5. $itemid=safe_convert($itemid);   
  6.   
  7. acceptrequest('tag,rewrite');   
  8. if ($tag!==''$job='show';   
  9. $tag=($config['smarturl']==1 && $config['urlrewrite']==1 && $rewrite==1) ? tagurldecode($tag) : $tag;   
  10. //缺省情况$config['smarturl']==1 && $config['urlrewrite']==1 这个条件是不成立的,所以不会调用tagurldecode函数   
  11. //要管理员使用urlrewite功能才可以   
  12.   
  13. if ($job=='default') {   
  14. ..........   
  15. }   
  16.   
  17. if ($job=='show') {   
  18.     acceptrequest('mode');   
  19.     if ($mode==1 || $mode==2) $mbcon['tag_list']=$mode-1;   
  20.   
  21.     $m_b=new getblogs;   
  22.     if ($tag==='') catcherror($lnc[192]);   
  23.   
  24.     //$tag 变量进入查询语句,但是需要一个单引号,我们恰好可以通过tagurldecode函数引入单引号   
  25.     $allentries=$blog->getgroupbyquery("SELECT * FROM `{$db_prefix}tags` WHERE `tagname`='{$tag}' LIMIT 0,1");   
  26.     if (!is_array($allentries[0]) || $allentries[0]['tagentry']=='<end>' || $allentries[0]['tagcounter']==0) {   
  27.   

$tag 变量进入查询语句是被单引号包围的,但是我们恰好可以通过tagurldecode函数引入单引号,看代码

 
  1. function tagurlencode($str) {//编码函数   
  2.     $str=urlencode($str);   
  3.     $str=str_replace('-''--'$str);   
  4.     $str=str_replace('%''-'$str);   
  5.     return $str;   
  6. }   
  7. function tagurldecode($str) { //解码函数   
  8.     $str=str_replace('-''%'$str);   
  9.     $str=str_replace('%%''-'$str);   
  10.     $str=urldecode($str);   
  11.     return $str;   
  12. }   


漏洞利用:

http://www.target.com/index.php?act=tag&job=show&rewrite=1&tag=aaaa-27


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

信息来源:
<* 来源:鬼仔'S Blog
连接:http://huaidan.org/archives/3066.html *>